[ SRE_ARENA ]
DATABASE SHARDING & CONSISTENT HASHING

Scaling the Unscalable Database.

Visualization: 1. Vertical vs Horizontal Scaling
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 INCIDENTYou 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