[ SRE_ARENA ]
Roadmap
System Design
SREdle
⚡ 1420 ELO
OP
☰
←
BACK TO ROADMAP
DATABASE SHARDING & CONSISTENT HASHING
Scaling the Unscalable Database.
Visualization: 1. Vertical vs Horizontal Scaling
Vertical Scale
Bigger CPU/RAM (Hits limits)
Horizontal Scale
More Servers (Infinite)
Shard A
Users A-M
Shard B
Users N-Z
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
1. Vertical vs Horizontal Scaling
2. Choosing the Shard Key
3. Consistent Hashing
DOWNLOADING CONCEPT: 1. VERTICAL VS HORIZONTAL SCALING...
↳
When your database hits 100% CPU, you can scale
Vertically
(buy a more expensive server with more RAM/CPU).
↳
But eventually, you hit a physical limit.
↳
The biggest AWS RDS instance only has 128 vCPUs.
↳
When you hit that wall, you must scale
Horizontally
(add more servers).
↳
But how do you split a single relational database across 5 different physical servers? This is called
Sharding
.
↳
You split the rows of your giant
Users
table across multiple databases.
↳
Shard A holds users A-M.
↳
Shard B holds users N-Z.
↳
Now you have effectively doubled your read/write throughput.
▲ LIVE INCIDENT
You are reviewing the database metrics for a massive multi-tenant SaaS application.
sre@arena:~/sharding
sre@arena
:
~
$
db_metrics check_shards --cluster-id prod-users
▶ EXECUTE COMMAND