13. Confidential & Proprietary
Data is synchronously replicated using Paxos consensus.
Update
Cloud Spanner instance
Zone A Zone B Zone C
DB 1
DB 2
DB 1
DB 2
DB 1
DB 2
Synchronous レプリケーションと高整合性
19. Confidential & Proprietary
id (PK) name address gender
101 samir tokyo m
102 hassy tokyo m
:
1001
1002
:
2001
2002
Table
Data Split 1
Data Split 2
Data Split 3
Key 101~1000
Key 1001~2000
Key 2001~2999
Split とは?
20. Confidential & Proprietary
NS NS NS NS
Zone 1 Zone 2
G-NA-F S-ZO-R G-NA-F S-Z O-R
Splits
Node Servers
100% Key Coverage
per Zone
Split のレイアウト
26. Confidential & Proprietary
Cloud Spanner には2種類のトランザクション:
1. Locking read-write transaction (mutation)
a. 悲観的ロック
a. 読み書きするセルのみをロック
2. Read-only transaction
a. 3 種類
i. Strong (デフォルト) :最新のデータを読む
ii. Bounded staleness:指定した範囲から最新のデータを読む
iii. Exact staleness:指定したタイムスタンプのデータを読む
b. ロックを行わない
トランザクションタイプ
50. Confidential & Proprietary
よく聞かれる2点
● Index を利用するには、明示的に指定する必要がある
FROM MyTable@{FORCE_INDEX=MyTableIndex}
● Index の STORING 機能を利用して、元テーブルにアクセスを避ける
CREATE INDEX AlbumsByAlbumTitle2 ON Albums(AlbumTitle) STORING
(MarketingBudget)
51. Confidential & Proprietary
Query Plan Cache
SQL クエリを Spanner で使用する際に、bound parameters を使用す
るのが重要です。
Cloud Spanner のノードは query plan cache の数が限られています。
クエリの中に静的パラメータを使用すると、各クエリが違うものと見られ
て、query plan cache を効果的に活用することができません。この問題
を避けるには、以下の例のようにクエリは parameter binding を利用す
る必要があります。
Statement statement = Statement
.newBuilder("SELECT name WHERE id > @msg_id AND
id < @msg_id + 100")
.bind("msg_id").to(500)
.build();
これ重要!
54. Confidential & Proprietary
イノベーションのために時間を作ろう!
Focus on value add and
innovation instead of
maintenance.
Simplify costing to better
understand your app.
Ensure your app stays online
and more secure - 99.999%
SLA.