Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
How to scale large database
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
duongkai
May 23, 2013
Programming
210
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How to scale large database
Bài nói về các kĩ thuật để mở rộng một database lớn.
duongkai
May 23, 2013
More Decks by duongkai
See All by duongkai
Common crypto flaws in finance mobile apps
duongkai
0
94
Tetcon-2015 Using TLS correctly
duongkai
2
370
How to use SSL/TLS correctly
duongkai
1
180
5S - Xây dựng và thực hiện
duongkai
0
170
Why Random Matters
duongkai
0
88
Crypto-101 @hackerspace 26/07/2013
duongkai
1
110
Trao đổi email
duongkai
0
170
+TetCon.2013_Hacking.Oracle.2012.pdf
duongkai
0
170
Other Decks in Programming
See All in Programming
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
110
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
270
ジョジョの世界をXRで再現する
mofurune
0
160
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
160
contenteditable と日本語入力に向き合う
colorful12
0
190
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
パスワード再設定メールのURLについて知っておこう
uyuki234
0
140
ChromeでローカルLLM
ryu1013
0
120
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
210
Event is what happens
moro
1
340
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5.1k
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
250
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Leo the Paperboy
mayatellez
10
2.4k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
430
How to Talk to Developers About Accessibility
jct
2
570
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Transcript
How To Scale Large Database Phạm Tùng Dương – CIO03
Course: Advanced Database
Overview • First glance about Large Database • Typical techniques
to scale • Database sharding • Database sharding in MySQL
First glance about Large Database
When You Talk about Large Database
Example Tumblr @2012
Example • 400 million active users • 5 billion pieces
of content per week • 3 billion photos uploaded per month Facebook@2010
Example • 1 billion tweets per week • 140 million
tweets sent per day • 456 tweets per second @MJ death • 6939 tweets per second on NY day Twitter@2011
What is The Large Database • Large working data sets
• I/O write intensive
Typical approaches
What is The Bottleneck? I/O, I/O and I/O
We have a job which is called Performance Tuning
Scale up • Adding more RAM, more CPU • High
I/O HDD
Scale topo Replication (Master – Slave) Master Slave Client Read/Write
Read Only Master Master Storage Client Cluster (shared storage)
Caching • Memcached • Redis
Finally, Everything in RAM is a Dream!
But, No Silver Bullet!
Database Sharding
What is Database Sharding • Horizontal Partitioning • Data is
stored in small chunks and distributed across many computers • Often use with Replication
Database sharding topo Primary DB Shard1 Shard2
Shard3 Slave1 Slave2 Slave3
3 types • Range sharding • List sharding (Lookup table)
• Hash sharding
Range sharding • Distributed by the range of Primary Key
• Example – Primary Key: user_id (1..1000) user_shard1 (1..500) user_shard2 (501..1000)
List sharding • Distributed data by the attribute of the
data • Example: database of people in VN – Sharded by the city_name (Ha_Noi, Hai_Phong, Da_Nang,…)
Hash sharding (modulus) • Distributed data by using a hash
function on primary key. • Example: primary_key mod N
Pros of Database Sharding • Easy to scale (data, write
I/O) • Using commodity hardware • Minimum effect when system failed
Cons of Database sharding • You MUST implement by yourselves
• Operation is harder • Handle join operation is very difficult • Data denormalization – > Don’t do it because it’s COOL!
Database Sharding in MySQL
Sharding Solutions • Application layer • Storage layer • Heavy
middleware • Lightweight middleware
Application layer • Hibernate Shards • HiveDB
Storage layer • MySQL Spider – Requires to change storage engine
of MySQL
Heavy Middleware • Twitter Gizzard • dbShards – Each db
has an agent
Lightweight Middleware • Acts like a proxy • Route the
request • Spock, CUBRID
You Will Do It Because You Have To … not
because it’s Cool!
Q&A