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
560
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
92
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
700
Machine Learning for the rescue
mariuszgil
0
430
Discovering graph structures
mariuszgil
3
560
Introduction to Aerospike with PHP
mariuszgil
8
850
Other Decks in Programming
See All in Programming
仕様漏れ実装漏れをなくすトレーサビリティAI基盤のご紹介
orgachem
PRO
7
3.1k
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
3
420
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.4k
Windows on Ryzen and I
seosoft
0
390
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
240
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
620
安いハードウェアでVulkan
fadis
1
790
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
160
How to stabilize UI tests using XCTest
akkeylab
0
140
Migration to Signals, Signal Forms, Resource API, and NgRx Signal Store @Angular Days 03/2026 Munich
manfredsteyer
PRO
0
150
LM Linkで(非力な!)ノートPCでローカルLLM
seosoft
0
190
飯MCP
yusukebe
0
340
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
11k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
94
Ethics towards AI in product and experience design
skipperchong
2
240
Rails Girls Zürich Keynote
gr2m
96
14k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
160
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Technical Leadership for Architectural Decision Making
baasie
3
300
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
[SF Ruby Conf 2025] Rails X
palkan
2
850
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
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]