At some point a single database server stops being enough. You add indexes, cache hot reads, move reads to replicas, buy a bigger machine. All of that helps, but one thing does not move: every write still lands on one primary, and all the data still has to fit on one machine. When writes or data size outgrow the biggest server you can reasonably run, the next step is sharding.
What sharding is
Sharding splits one logical database into several smaller databases, called shards , each running on its own server. Every shard has the same schema but holds a different subset of the rows. Together, the shards contain all the data.
Example: an app with 40 million users. Instead of one users table on one server, you run four servers. Users 1 to 10 million live on shard 1, the next 10 million on shard 2, and so on. Each server stores a quarter of the data and handles about a quarter of the writes.
That is the whole point. Replication copies the same data to more machines, which helps reads.…