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
690
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
maplibre-gl-layers - 地図に移動体たくさん表示したい
kekyo
PRO
0
300
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
13
8.2k
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
140
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.9k
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
160
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.4k
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
0
130
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
570
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.1k
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
140
Claude Codeログ基盤の構築
giginet
PRO
7
3.5k
nuget-server - あなたが必要だったNuGetサーバー
kekyo
PRO
0
280
Featured
See All Featured
Ruling the World: When Life Gets Gamed
codingconduct
0
180
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
240
Building Applications with DynamoDB
mza
96
7k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.7k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
90
Designing Experiences People Love
moore
143
24k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Ethics towards AI in product and experience design
skipperchong
2
230
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
130
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
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]