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
ソーシャルゲームDBの危機回避
Search
Ryosuke Suto
December 12, 2014
Technology
10
14k
ソーシャルゲームDBの 危機回避
MySQL Casual Talks vol.7
Ryosuke Suto
December 12, 2014
Tweet
Share
More Decks by Ryosuke Suto
See All by Ryosuke Suto
横断的なSRE推進と成熟度評価
strsk8
9
7.3k
GKEを利用したサービスの運用
strsk8
1
580
パブリック/プライベートクラウドでつかうKubernetes
strsk8
1
2.3k
GKE@AbemaTV
strsk8
12
9.2k
re:Invent2015参加レポ
strsk8
0
270
成長し続けるインフラの安定運用事情
strsk8
19
5.1k
Other Decks in Technology
See All in Technology
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.4k
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
480
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
940
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
370
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
1
370
DynamoDB でスロットリングが発生したとき/when_throttling_occurs_in_dynamodb_short
emiki
0
240
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
180
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
110
TypeScript、上達の瞬間
sadnessojisan
46
13k
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
160
AGIについてChatGPTに聞いてみた
blueb
0
130
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Gamification - CAS2011
davidbonilla
80
5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
Visualization
eitanlees
145
15k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Agile that works and the tools we love
rasmusluckow
327
21k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Speed Design
sergeychernyshev
25
620
Done Done
chrislema
181
16k
Transcript
CyberAgent, Inc. Ryosuke Suto ιʔγϟϧήʔϜ%#ͷ ةػճආ MySQL Casual
Talks vol.7 2014/12/07
$ZCFS"HFOU *OD ΞδΣϯμ ࣗݾհ σΟεΫ༰ྔͷةػΛճආ͢Δ ϨϓϦԆͷةػΛճආ͢Δ
ਢ౻ྋհʢ͢ͱ͏Γΐ͏͚͢ʣ @strsk גࣜձࣾαΠόʔΤʔδΣϯτ ΠϯϑϥˍίΞςΫຊ෦ ISUCON4 ༧બഊୀ $ZCFS"HFOU *OD
$ZCFS"HFOU *OD σΟεΫ༰ྔͷةػΛճආ͢Δ
$ZCFS"HFOU *OD
$ZCFS"HFOU *OD ΪϑτϘοΫεͱ ΧʔυҰཡͷ্ঢ͕Ϡό͍ • OͷσʔλͰ৽ँ͕ܹ͍͠ • ཤྺදࣔௐࠪͷͨΊɺҰఆظؒͷσʔλඞཁ •
ΠϕϯτͷϐʔΫ࣌े(#%BZ૿͑Δ͜ͱ • ཧআͨ͠··Ͱͯ͠ͳ͔ͬͨΓʜ
6 CyberAgent, Inc. Ϡό͍ʂʂʂ
$ZCFS"HFOU *OD ͬͨ͜ͱ • ཧআ͞Ε͍ͯΔɺҰఆظؒܦͬͨσʔλΛআ • আྔ͕ଟ͗͢ΔͷͰϝϯςϯε࣮ࢪ • */4&35*/504&-&$5ͱ3&/".&Ͱ࡞Γͳ
͓͢ • σʔλআόονΛͭͬͯ͘ఆظతʹআ
$ZCFS"HFOU *OD CREATE TABLE giftbox_new LIKE giftbox; INSERT INTO
giftbox_new SELECT giftbox WHERE (status = 1 AND updated > ‘2014-11-07 00:00:00’) OR (status = 0); RENAME giftbox giftbox_bk, giftbox_new giftbox; DROP TABLE giftbox_bk;
$ZCFS"HFOU *OD %&-&5&ͯ͠ ۭ͖༰ྔ͕૿͑ͳ͍ • IUUQOJQQPOEBOKJCMPHTQPUKQ JOOPECIUNM • %&-&5&ͯ͠আ͞ΕͨϚʔΫ͕͞ΕΔ͚ͩͰ༰
ྔݮΒͳ͍ • 015*.*;&͢ΔͨΊʹQUPTDΛ͔ͭ͏
$ZCFS"HFOU *OD $ pt-online-schema-change –-execute --alter=“engine=InnoDB” h=localhost,D=db_name,t=giftbox,u=root Α͔ͭ͘͏Φϓγϣϯ TFUWBSTlTRM@MPH@CJOzʜϨϓϦͤͨ͘͞ͳ͍࣌
DSJUJDBMMPBEʜεϨου͕͜ΕΛ͑Δͱதஅ NBYMPBEʜεϨου͕͜ΕΛ͑ΔͱҰ࣌ఀࢭ
$ZCFS"HFOU *OD ةػճආʂ
12 CyberAgent, Inc. ةػճආʂʂʂ
$ZCFS"HFOU *OD ϨϓϦԆͷةػΛճආ͢Δ
$ZCFS"HFOU *OD 536/$"5&ͨ͠ΒԆ • ήʔϜͷϚελσʔλ͕ຖճσʔλΛΫϦΞͯ͠ ಡΈࠐΉελΠϧ • ςʔϒϧΛ536/$"5&ͯ͠Δ෦ͰԆ͕ ൃੜ͍ͯ͠Δ
• %&-&5&͢ΔΑΓ͍
$ZCFS"HFOU *OD খ͍͞ςʔϒϧͰ͍ • ༰ྔ.#ɺ ߦ • 536/$"5&TFD •
%&-&5&TFD
16 CyberAgent, Inc. ͍ʂʂʂ
$ZCFS"HFOU *OD όάͩͬͨ • IUUQXXXQFSDPOBDPNCMPH QFSGPSNBODFQSPCMFNXJUIJOOPECBOEESPQ UBCMF • 536/$"5&は%301$3&"5&
• lJOOPEC@pMF@QFS@UBCMFzͰ%301࣌ͷόά • όοϑΝϓʔϧͷར༻ྔ͕େ͖͍΄Ͳ͘ͳΔ
$ZCFS"HFOU *OD %&-&5&ʹͯ͠Ԇճආ • σʔλྔ͕ଟ͍ͱ%&-&5&Ͱ͘ͳΔ • εϨʔϒˠϚελʔͷॱͰ࣮ߦͯ͠ճආ Slave> DELETE
FROM masterdata; Master> DELETE FROM masterdata; Master> INSET INTO masterdata (hoge,fuga,…) VALUES (xxx,yyy,…); ʢུʣ
19 CyberAgent, Inc. ةػճආʂʂʂ