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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Mariusz Gil
April 12, 2013
Programming
570
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Database scaling patterns
Mariusz Gil
April 12, 2013
More Decks by Mariusz Gil
See All by Mariusz Gil
Aspect Oriented Programming
mariuszgil
1
350
Designing and implementing GraphQL API
mariuszgil
1
110
Discovering unknown with EventStorming ConFoo
mariuszgil
0
320
Game of Developer Life... Deconstructed
mariuszgil
1
200
Back to forgotten roots
mariuszgil
1
440
Go micro with microservices
mariuszgil
5
710
Machine Learning for the rescue
mariuszgil
0
460
Discovering graph structures
mariuszgil
3
560
Introduction to Aerospike with PHP
mariuszgil
8
880
Other Decks in Programming
See All in Programming
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
420
php-fpmのプロセスが枯渇した日-調査・対処・そして本当にやるべきだったこと-
shibuchaaaan
0
170
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
270
yield再入門 #phpcon
o0h
PRO
0
820
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
230
ここ半年くらいでAIに作らせたR用ツール
eitsupi
0
340
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
17k
What's New in Android 2026
veronikapj
0
240
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
1.8k
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
300
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
730
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
110
Featured
See All Featured
Designing for Timeless Needs
cassininazir
1
410
Chasing Engaging Ingredients in Design
codingconduct
0
240
Believing is Seeing
oripsolob
1
170
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
400
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
160
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
540
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]