Database Scaling
A single database server has limits on connections, disk I/O, and CPU. Three techniques push past those limits: read replicas, vertical sharding, and horizontal sharding. Read replicas copy data from the primary asynchronously. Reads go to replicas; writes go to the primary. This works when reads outnumber writes — which describes most web applications. Vertical sharding splits different tables across different databases: users in one, orders in another. Horizontal sharding splits one table across multiple database servers by a shard key. It is powerful but complex — cross-shard joins are impossible, and a bad shard key creates hot spots that defeat the purpose.