When Your Cart’s Full and the DB Crashes: How to Scale Reads

You’re in a Flash Sale… and the Site Dies
Imagine you’re racing through an online Black Friday sale—your cart is full, you hit Checkout, and… boom, the site crashes. Frustrating, right? You were this close to snagging that deal, but the server just couldn’t keep up.
1. Why Databases Become Bottlenecks
Most of your app’s magic lives in the database. Every product page, every comment, every article view—it’s all a read from your DB. When thousands (or millions!) of people flood in at once, that one box starts sweating bullets.
And when it chokes, your users see errors instead of “Add to Cart.” Not great for business—or reputation.
2. Read‑Heavy Workloads: Examples
Think of apps where reads >> writes:
Social feeds (Instagram, Twitter)
News sites (Hacker News, BBC)
Streaming catalogs (Netflix browse screen)
E‑commerce listings (Amazon product pages)
Your DB is getting hammered with GETs, with only occasional POSTs or PUTs.
3. What Is Replication?
Replication means spinning up extra DB “clones” whose sole job is to handle reads. You keep one primary for writes (POST, PUT, DELETE), and you funnel all GETs to the replicas.
After every write, you propagate those changes from primary → replicas. Now read traffic is spread out, and your primary isn’t the only one doing the heavy lifting.
4. Types of Replication
Asynchronous (fast, eventual consistency): replicas lag a tiny bit, but writes aren’t held up.
Synchronous (strong consistency): primary waits for replicas to confirm—safer, but adds latency.
You can also choose:
Primary–Secondary (one writer, many readers)
Multi‑Primary (multiple writers, complex conflict handling)
5. Pitfalls & Monitoring
Replication sounds simple, but watch out for:
Replication lag: how stale are your reads?
Split‑brain: two primaries disagreeing—ouch.
Failover handling: if primary dies, how fast does a replica step up?
Keep an eye on metrics like replication lag, read QPS, and replica health in your dashboard.
[Primary DB] ← writes ← API
↓ (async)
[Replica A] → reads ← Frontend
[Replica B] → reads ← Frontend
6. What’s Next: Write Scaling & Sharding
Replication keeps reads humming, but it won’t save you from write storms. In Part 2, we’ll dive into sharding—splitting your data across multiple primaries so both reads and writes can scale without breaking a sweat.
Subscribe to my newsletter
Read articles from Dichan Shrestha directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
