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
Database scaling patterns
Search
Mariusz Gil
April 12, 2013
Programming
560
2
Share
Database scaling patterns
Mariusz Gil
April 12, 2013
More Decks by Mariusz Gil
See All by Mariusz Gil
Aspect Oriented Programming
mariuszgil
1
330
Designing and implementing GraphQL API
mariuszgil
1
99
Discovering unknown with EventStorming ConFoo
mariuszgil
0
320
Game of Developer Life... Deconstructed
mariuszgil
1
190
Back to forgotten roots
mariuszgil
1
420
Go micro with microservices
mariuszgil
5
700
Machine Learning for the rescue
mariuszgil
0
440
Discovering graph structures
mariuszgil
3
560
Introduction to Aerospike with PHP
mariuszgil
8
860
Other Decks in Programming
See All in Programming
AWSコミュニティ活動は顧客のクラウド推進に効くのか / Do AWS community activities help customers adopt the cloud?
seike460
PRO
0
170
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
970
10 Tips of AWS ~Gen AI on AWS~
licux
5
540
いつか誰かが、と思っていた フロントエンド刷新5年間の実践知
kiichisugihara
1
250
書き換えて学ぶTemporal #fukts
pirosikick
2
350
エラー処理の温故知新 / history of error handling technic
ryotanakaya
7
1.8k
PHPer、Cloudflare に引っ越す
suguruooki
1
140
ハーネスエンジニアリングとは?
kinopeee
13
6.8k
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
310
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
990
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
1.5k
JOAI2026 1st solution - heron0519 -
heron0519
0
180
Featured
See All Featured
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
560
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.6k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
100
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
230
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
270
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.7k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
140
Fireside Chat
paigeccino
42
3.9k
KATA
mclloyd
PRO
35
15k
Transcript
Database scaling patterns Mariusz Gil the we a way
ABOUT ME
EXPERIENCE from 1 to 100+ DB servers
EXPERIENCE from 1 to 100+ DB servers
What i it a ABOUT ?
DATABASE IS MAIN PROBLEM IN 99% OF WEB APPS
TYPICAL ISSUES? NORMALIZED TO xNF INEFFICIENT SCHEMA, BAD INDEXES AND
QUERIES, UNUSED SLOW-LOG
shared setup
!" # $ %% & ' !( !" # !" # shared server
cache all the things, wisely...
!" # $ %% & ' !( !" # !" # shared server
separated servers
!" # $ %% & ' !( !" # !" # DB server
scale up
scale up
denormalization
DB server
!" # $ %% & ' !( !" # !" # !" # $ %% & ' !( !" # !" # DB server
DB server
!" # $ %% & ' !( !" # !" # DB server !" # $ %% & ' !( !" # ) !" # )
DB server DB server
!" # $ %% & ' !( !" # ) !" # ) # $ %% & ' !( !" # !" # ID SENDER_ID RECEIVER_ID ... 1 10 1 2 20 2 3 10 1 4 20 3 5 10 1 6 20 4 7 10 1 USER_ID MESSAGE_ID 1 1 1 3 1 5 1 7 2 2 3 4 4 6 USER_ID MESSAGE_ID 10 1 10 3 10 5 10 7 20 2 20 4 20 6
replication
MASTER-SLAVE scale reads, but not writes
DB master
!" # $ %% & ' !( !" # ) !" # ) DB slave !" # $ %% & ' !( !" # ) !" # ) DB slave !" # $ %% & ' !( !" # ) !" # ) ... INSERT... UPDATE... DELETE... SELECT... SELECT...
MASTER-MASTER just for HA, not for scaling
DB master
!" # $ %% & ' !( !" # ) !" # ) DB master !" # $ %% & ' !( !" # ) !" # ) INSERT... UPDATE... DELETE... SELECT...
sharding
DB shard $ %% &
' !( !" # ) !" # ) DB shard !" # $ %% & ' !( !" # ) !" # ) DB shard !" # $ %% & ' !( !" # ) !" # ) INSERT... UPDATE... DELETE... SELECT... INSERT... UPDATE... DELETE... SELECT... INSERT... UPDATE... DELETE... SELECT...
Sharding i HARD !
Resharding i HARDER !
JOINS FORGET ABOUT IT data could be splitted into many
shards
ALTERS THINK TWICE ABOUT IT altering many shards could be
a nice challenge
fault tolerant multi-master sharding
SCALE WHEN NECESSARY NOT FOR FUN
Alternative TOOLS ?
None
None
None
None
None
Thanks! Any questions? @mariuszgil
[email protected]