Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DatastoreからSpannerへのゼロダウンタイム移行
Search
Kanji Yomoda
February 18, 2021
0
110
DatastoreからSpannerへのゼロダウンタイム移行
Kanji Yomoda
February 18, 2021
Tweet
Share
More Decks by Kanji Yomoda
See All by Kanji Yomoda
Elasticstack Terraform Providerの最近のアップデート
kyomo
0
89
Goで作る全文検索エンジンライブラリ
kyomo
0
1k
Terraform Provider開発のノウハウ
kyomo
1
200
Paper reading - ROSE: Robust Caches for Amazon Product Search
kyomo
0
39
Elasticsearch Aggregations
kyomo
0
61
AlloyDB overview
kyomo
0
88
Unsupervised synonym Extraction
kyomo
0
220
pubsub_cli - CLI Tool for Cloud Pub/Sub
kyomo
0
96
DRY & 型安全にテスト用structを初期化しよう
kyomo
1
610
Featured
See All Featured
Scaling GitHub
holman
458
140k
Docker and Python
trallard
42
3.1k
GraphQLとの向き合い方2022年版
quramy
44
13k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
A designer walks into a library…
pauljervisheath
204
24k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
How to Think Like a Performance Engineer
csswizardry
22
1.2k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
A Philosophy of Restraint
colly
203
16k
Designing Experiences People Love
moore
138
23k
Making the Leap to Tech Lead
cromwellryan
133
9k
Transcript
Datastore͔ΒSpannerͷ θϩμϯλΠϜҠߦ Kanji Yomoda
ࣗݾհ Kanji Yomoda / BIR @k__yomo - ৽ଔͰM3ʹೖࣾ͠ݱࡏ2 - αʔόʔαΠυ(Go)ɺΫϥυΠϯϑϥ(GCP,
Terraform) पΓΛओʹ୲
࣍ 1. Ξϯέʔτ৴γεςϜͱ 2. Datastoreར༻࣌ͷ՝ 3. ҠߦઌબఆɾPoC 4. Ҡߦઃܭ 5.
Ҡߦޙͷ݁Ռ 6. ݱࡏͷӡ༻ɾࠓޙͷ՝
1. Ξϯέʔτ৴γεςϜͱ
1. Ξϯέʔτ৴γεςϜͱ • Ϣʔβʔͷ࠷దͳΞϯέʔτ৴Λͱ͢ΔϚΠΫϩαʔϏε ◦ ୭ʹͲͷνϟωϧ(ΞϯέʔτҰཡϖʔδɺαΠτࠂɺϝʔϧɺαΠτ௨ )ͰͲΕ͘Β͍৴͢Δ͔ • ֤ΞϯέʔτγεςϜͱCloud Pub/SubΛ༻͍ͯඇಉظʹ࿈ܞ
(Ξϯέʔτ৴։࢝ɺճใͷಉظͳͲ) • Go, App Engine, Datastore, Cloud Pub/Sub
1. Ξϯέʔτ৴γεςϜͱ(DBؔ࿈) • m3.comͷτοϓϖʔδͱಉ͘͡Β͍ͷΞΫηεྔ • READϔϏʔ (ϢʔβʔͷαΠτΞΫηε࣌ʹɺճՄೳͳΞϯέʔτΛฦ͢ॲཧ͕ϝΠϯ) • ϢʔβʔͷIDͰσʔλΛҾ͘Ϣʔεέʔε͕ओͳͨΊDatastoreΛॳ࠾༻
1. Ξϯέʔτ৴γεςϜͱ(σʔλಉظ) • Cloud Pub/SubͷPush SubscriptionΛར༻͠ɺ ΞϯέʔτγεςϜ͔Β৴ใճใΛऔಘ • Pub/Subͷϝοηʔδ(Πϕϯτ)ͷड͚ޱશͯԼهΛຬͨ͢ɻ ◦
ႈ ◦ ॱෆಉ => ԿճͲͷॱংͰདྷͯϝοηʔδ͕શͯॲཧ͞Ε͑͢͞Ε݁Ռ߹͕อͨΕΔ
2. ৴γεςϜͰͷDatastoreར༻࣌ͷ՝ 1. ΞϓϦέʔγϣϯͰͷෳࡶɾͳJOIN 2. ैྔ՝ۚͳͷͰɺΞϓϦέʔγϣϯͷεέʔϧʹͬͯྉۚεέʔϧ͢Δ ճආํ๏͋Δ͕ɺͦͪΒख͕͔͔ؒΔ 1. 1ʹΑΔϨΠςϯγ্ঢɺ2ʹΑΔྉۚ૿ՃͷճආͷͨΊʹΩϟογϡґଘ =>
ߴϨΠςϯγɺߴྉۚɾߴ։ൃίετɺΩϟογϡґଘ(Redis) લఏ: εΩʔϚઃܭΛਖ਼نԽͯ͠͠·͍ͬͯͨ
શΞϯέʔτγεςϜͷ৴ / ճͷήʔτΣΠΛ୲͍ͬͯΔͨΊɺ ৴γεςϜ͕ࢭ·ΔͱΞϯέʔτશମ͕ࢭ·Δ => ग़དྷΕ৴γεςϜΛࢭΊͨ͘ͳ͍ 3. Ҡߦ࣌ͷ՝
- ϨΠςϯγͷԼ - ։ൃίετͷԼ - Ωϟογϡґଘ͔Βͷ٫ - + ৴γεςϜΛग़དྷΔ͚ͩࢭΊͳ͍ 3.
ղܾ͍ͨ͠՝·ͱΊ
3. Ҡߦઌબఆ - Cloud Spanner or Cloud SQL(PostgreSQL) - Մ༻ੑ
& εέʔϥϏϦςΟ & ٕज़తઓ => Cloud Spanner
3. Cloud SpannerͷPoC - Datastore & ݁Ռ߹ੑ͔ΒͷҠߦͩͬͨͨΊɺ੍؇ͷํ - ओʹRDBMSͱͷࠩ(εΩʔϚઃܭɺΫϥΠΞϯτϥΠϒϥϦɺSQL)Λ֬ೝ -
ΠϯλʔϦʔϒͷ֓೦ - mutation্ݶ - window͕ؔ͑ͳ͍ - ຊ൪૬ͷσʔλΛ༻ҙ͠ෛՙςετ
4. Ҡߦઃܭ Datastoreͷಉظܦ࿏ͨ͠··ɺ৽ͨʹSpanner༻ͷಉظܦ࿏ΛՃ - ݁Ռ߹ੑʹΑΔθϩμϯλΠϜҠߦ͕Մೳ - DatastoreͷΓ͕͠༰қ
None
None
“ϝοηʔδ͕શͯॲཧ͞Ε͑͢͞Ε࠷৽ͷঢ়ଶ͕อͨΕΔ” ͨΊɺ ↑ͷΑ͏ʹ͢ΔࣄͰɺաڈσʔλಉظதʹߋ৽͕͋ͬͨϨίʔυPub/Subϝο ηʔδ͔ΒͷಉظͰશͯ࠷৽ͷঢ়ଶʹߋ৽͞ΕΔ
1. Spanner༻ͷPub/Sub PushαϒεΫϦϓγϣϯΛՃ (͜ͷ࣌ͰPushઌͷΤϯυϙΠϯτ͕ͳ͍ͨΊɺϝοηʔδཹ) 2. Datastore͔Βͷաڈσʔλશಉظ 3. Spanner༻Pub/Sub PushઌΤϯυϙΠϯτՃΛϦϦʔε (ཹϝοηʔδ͕ॲཧ͞ΕΔ)
4. σʔλͷ߹ੑνΣοΫ 5. SpannerଓΓସ͑ϦϦʔε 4. Ҡߦઃܭ
DI͢ΔϦϙδτϦΛ DatastoreͱSpannerͰΓସ͑ Δ ࣮
4. ҠߦʹͨͬͯؾΛ͚ͭͨ - ग़དྷΔ͚ͩϩʔϧόοΫՄೳͳঢ়ଶΛอͭ (ࠓճϦϦʔεޙ1ϲ݄ޙ΄ͲDatastoreͷಉظซ) - DBҠߦҎ֎ͷ͜ͱΛߦΘͳ͍(ϦϑΝΫλϦϯάͳͲ)
5. Ҡߦޙͷ݁Ռ - θϩμϯλΠϜͰͷҠߦޭ - 400msޙΛ͏Ζ͍͍ͭͯͨϨΠςϯγ͕100msʹ - Ωϟογϡͷґଘ٫ - SQLʹΑͬͯΞϓϦέʔγϣϯͷίʔυ͕ཧ
6. ݱࡏͷӡ༻ - Spannerຊ൪Πϯελϯε(1~3node)ͱqaɾϩʔΧϧ։ൃڞ༗ͷΠϯελϯε(1node) - xo/xoͷSpanner൛Ͱ͋Δcloudspannerecosystem/yoΛར༻ (εΩʔϚ͔ΒGoͷDTOίʔυΛੜ͢ΔϥΠϒϥϦ) - QAڥͷεΩʔϚ ϚΠάϨʔγϣϯwrenchɺຊ൪ख࡞ۀ
- CISpannerͷΤϛϡʔϨʔλʔΛ༻
6. ࠓޙͷ՝ ҆ఆతͳӡ༻ͷཱ֬ - εΩʔϚ ϚΠάϨʔγϣϯͷඋ - Φʔτεέʔϧ - CIͷຊSpannerʹΑΔςετ࣮ߦͷՃ
(ݱࡏCIͰΤϛϡϨʔλͷΈ༻)
·ͱΊ - Datastoreར༻࣌ͷ՝ɾ৴γεςϜͷ͔ΒSpannerͷҠߦΛܾఆ - Cloud Pub/SubͱσʔλಉظͷઃܭΛ׆༻͠ɺ θϩμϯλΠϜͰͷDBҠߦΛ࣮ࢪ - ݱࡏΑΓ҆ఆతͳӡ༻Λࢦͯ͠վળத