How it works
A practical path starts simple, separates web and data, adds web redundancy, replicates the database, caches repeated reads, serves static assets from a CDN, keeps web servers stateless, and introduces regional failover and background work when the workload demands them. There is no universal checklist to deploy all at once.
Here is one illustrative history, told in signals. At 5,000 daily users, one server has headroom, so nothing changes. At 50,000, the database and application compete for memory, so the database moves out. At 200,000, web CPU peaks at 85% and a single failure would mean an outage, so a load balancer and three web servers arrive, which forces sessions out of server memory. At one million, database reads hit 70% of capacity while writes stay low, so a cache and two replicas follow. Another product would take a different order: a video service needs a CDN early, and a sensor platform with heavy writes may need partitioned storage long before replicas help.
Match the symptom to the remedy. If reads are slow, inspect query and cache behavior; if writes overload the primary, read replicas alone will not fix it; if one shard is hot, more evenly sized shards may not solve the hotspot. Observe, choose one bottleneck, and test the effect of the change. Every addition has a running cost: another system to patch, monitor, and reason about during an outage, and another way for data to be stale or lost.
Writes are saturating your primary while reads are healthy. A colleague proposes two more replicas and a larger cache.
Neither helps, because both target reads and every write still reaches the primary. Confirm the write path is the limit, then look at batching writes, moving deferrable work to a queue, dropping unused indexes, or a larger primary. Shard only if those are not enough.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Match the technique to the bottleneck and its failure mode.
- Revisit tradeoffs after every change; each new component needs an operating plan.