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
2
550
Database scaling patterns
Mariusz Gil
April 12, 2013
Tweet
Share
More Decks by Mariusz Gil
See All by Mariusz Gil
Aspect Oriented Programming
mariuszgil
1
330
Designing and implementing GraphQL API
mariuszgil
1
90
Discovering unknown with EventStorming ConFoo
mariuszgil
0
310
Game of Developer Life... Deconstructed
mariuszgil
1
190
Back to forgotten roots
mariuszgil
1
410
Go micro with microservices
mariuszgil
5
690
Machine Learning for the rescue
mariuszgil
0
420
Discovering graph structures
mariuszgil
3
550
Introduction to Aerospike with PHP
mariuszgil
8
840
Other Decks in Programming
See All in Programming
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
360
Head of Engineeringが現場で回した生産性向上施策 2025→2026
gessy0129
0
200
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
120
朝日新聞のデジタル版を支えるGoバックエンド ー価値ある情報をいち早く確実にお届けするために
junkiishida
1
290
Claude Codeと2つの巻き戻し戦略 / Two Rewind Strategies with Claude Code
fruitriin
0
200
PJのドキュメントを全部Git管理にしたら、一番喜んだのはAIだった
nanaism
0
220
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
12
6.1k
AHC061解説
shun_pi
0
270
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
500
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
140
CSC307 Lecture 09
javiergs
PRO
1
850
AI駆動開発の本音 〜Claude Code並列開発で見えたエンジニアの新しい役割〜
hisuzuya
3
430
Featured
See All Featured
From π to Pie charts
rasagy
0
140
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.7k
Done Done
chrislema
186
16k
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Building an army of robots
kneath
306
46k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
New Earth Scene 8
popppiees
1
1.7k
Bash Introduction
62gerente
615
210k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
How to make the Groovebox
asonas
2
2k
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]