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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
320
Designing and implementing GraphQL API
mariuszgil
1
85
Discovering unknown with EventStorming ConFoo
mariuszgil
0
310
Game of Developer Life... Deconstructed
mariuszgil
1
180
Back to forgotten roots
mariuszgil
1
400
Go micro with microservices
mariuszgil
5
680
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
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
550
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
250
AtCoder Conference 2025
shindannin
0
1k
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
180
Package Management Learnings from Homebrew
mikemcquaid
0
210
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
130
SourceGeneratorのススメ
htkym
0
190
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
CSC307 Lecture 01
javiergs
PRO
0
690
Basic Architectures
denyspoltorak
0
660
CSC307 Lecture 08
javiergs
PRO
0
670
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
Featured
See All Featured
Darren the Foodie - Storyboard
khoart
PRO
2
2.3k
Technical Leadership for Architectural Decision Making
baasie
1
240
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
290
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
51
Practical Orchestrator
shlominoach
191
11k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
140
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]