LESSON 12 · Put it together

Scale in response to evidence

Each technique answers a different pressure on the system.

SYSTEM VIEW

The architecture

Diagram view
Daily users—
Evidence—
Parts—

Watch a site grow to a million daily users in one illustrative history, each change answering one signal.

  1. At 5,000 daily users, one server runs both the app and the database and still has headroom. There’s no pressure to answer, so nothing changes.

    What changed

    • One server runs app and database
    • No signal, so no change
  2. At 50,000 daily users, the application and the database compete for memory on that one server. So the database moves out to a server of its own.

    What changed

    • Database server
    • Web server runs only the app
  3. At 200,000, web CPU peaks at 85% and a single failure would mean an outage. A load balancer arrives and the web tier grows to three servers, which forces sessions out of server memory.

    What changed

    • Load balancer
    • 2 more web servers
    • Sessions leave server memory
  4. At one million, database reads hit 70% of capacity while writes stay low. So a cache and two read replicas follow: both take reads, and the primary keeps the writes and copies them out.

    What changed

    • Cache
    • 2 replicas copy the primary
    • Primary keeps the writes
  5. With no new signal, nothing else is added. Each part is another system to patch, monitor and reason about during an outage, and another way for data to be stale or lost.

    What changed

    • 8 parts to patch and monitor
    • More ways for data to go stale
  6. If reads are slow, inspect query and cache behavior. If writes overload the primary, read replicas alone won’t fix it. Observe, choose one bottleneck, and test the change.

    Symptom

Space plays · ← → step · Home resets

THE IDEA

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.

DECISION POINT

Writes are saturating your primary while reads are healthy. A colleague proposes two more replicas and a larger cache.

Write a sentence or two to unlock the guidance. Committing first is what makes it stick.

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.
CHECK YOUR UNDERSTANDING

Put it into practice.

1 OF 2
ApplyQUESTION 01

Reads are slow because the same stable product details are fetched repeatedly. What is a targeted first improvement?

Choose an answer. You’ll see the explanation once you get it right.

Design a photo-sharing service

Bring the chapter together in one design, then revisit it when the requirements change.

The brief

People upload photos, browse the newest public photos, and open an image. Design the first version for one million registered users, with 100,000 active each day. Keep comments, followers, private albums, and video outside this exercise.

  • Each active user uploads 2 photos and views 100 images per day.
  • An original photo averages 3 MB; a delivered image averages 200 kB. Use decimal units and 86,400 seconds per day.
  • Peak traffic is 5 times the daily average. Estimate 30 days of new original-photo storage, before extra copies or renditions.
  • Uploads may process in the background. A photo appears in public lists only when its image is ready; an accepted upload must survive an application-process crash.
  • Aim for 300 ms p95 photo-list API reads for users near the origin. Treat this as a target to verify, not a guarantee from the architecture.

Reading a design isn’t the same as producing one under a clock. Try it timed: the requirement change stays hidden until partway through.

Loading your draft…

State your scope and assumptions. Estimate average and peak upload and image-read rates, plus 30 days of original-photo storage. Keep units visible.

0 / 4,000 characters

Name the components and what each stores or does. Trace one upload and one image view, including when metadata becomes visible. An arrow list is enough.

0 / 4,000 characters

Choose a likely bottleneck and the evidence that would justify scaling it. Explain how you recover from an application crash or repeated processing job without losing an accepted photo.

0 / 4,000 characters

Respond to the international-traffic change below. Separate slow image delivery from slow API reads, and explain one cost of your change.

The requirement changesHalf your active users now live in Europe and Asia, far from the original region. Images arrive quickly through the CDN, but photo lists feel slow. What would you measure and change? Name the new consistency or operational tradeoff.

0 / 4,000 characters

Write an initial response in all four sections to unlock the checklist and two worked approaches.

0 of 2 checkpoints answered correctly to complete this lesson.