Four million sleepers and three questions
A sleep-tracking app has 4 million daily active users, people who open it at least once on a given day; a wristband records their nights and the phone uploads them. Before anyone draws a database, the design review has three questions: does the API need a cache, does the database need sharding, and does anything need a CDN? Back-of-envelope estimation answers them with deliberately rough arithmetic. Its job is to say which parts of the design actually need to scale, and for that the power of ten matters most. A wrong architecture chosen for the wrong order of magnitude is far more expensive than a factor-of-two error in the estimate, so round hard and keep moving: computing 3.47 million requests a day is precision the decision cannot use.
From people to requests a second
Start with what people do. A typical active user opens the app five times a day, and each open makes about four API calls: profile, last night, weekly trends, notifications. That is 4 million × 5 × 4 = 80 million requests a day.
A day has 86,400 seconds, about 10⁵, which gives the one conversion worth memorising: 1 million requests a day is about 12 a second, and 100 million about 1,200. So 80 million a day averages a little under 1,000 a second (80 × 11.6 ≈ 930).
Nobody lives at the average. Most of the app's users live within a few time zones and look at last night soon after waking, so if 40% of the day's requests land in the three busiest morning hours, those hours carry 32 million requests in 10,800 seconds: about 3,000 a second across the peak, three times the average, with the busiest minutes higher still. Without a measured daily shape, multiplying the average by 2–5x is the usual guess, and a launch can be far spikier. Size for the peak, because launch day is not the average day.
Writes are a separate stream. If 60% of active users sync a night, that is 2.4 million uploads a day, about 28 a second. Reads outnumber writes about 33 to 1. The read:write ratio is often the number that most changes the architecture, because it says where to invest: at 33:1 or 100:1, first in the read path (caching, replicas).
Storage: the night, not the row
Each night produces a summary row (hours slept, sleep stages, a score, a few IDs) of about 1 KB, and the recording behind it: heart rate and movement once a second, about 4 bytes a reading, so an 8-hour night is 28,800 readings, about 115 KB. Storage is rows a day × bytes a row × how long you keep them, before replicas and backups multiply it:
- Summaries: 2.4 million × 1 KB = 2.4 GB a day, under 1 TB a year.
- Recordings: 2.4 million × 115 KB ≈ 276 GB a day, about 100 TB a year, kept for as long as users want to look back at old nights.
The two figures send the data to different places. At under a terabyte a year, the summaries fit one database for years. Tens of terabytes a year usually means sharding or object storage, and write-once files read whole are what object storage is for (Object storage & blobs). Kept in the database, the recordings would have pushed it toward sharding within its first year.
Bandwidth: small here, and why that is news
Bandwidth is requests a second × bytes a response. The 3,000 peak requests carry about 5 KB each: 15 MB/s, roughly 120 Mbit/s, which one server's network link handles. Uploads and recording downloads add megabytes a second, not gigabytes. This app is light on the wire.
Change one thing and it is not. If the app also streamed a 3 MB wind-down audio track, played 10 million times a day, the audio alone would be 30 TB a day: about 350 MB/s, or 2.8 Gbit/s, on average, before any peak. Media payloads measured in megabytes dominate everything else combined, the signal for a CDN (CDN & static delivery): a system can be tiny on disk and enormous on the wire.
Memory: the working set
A cache earns its place when the data asked for again and again fits in memory. That data is the working set, and here it is today's active users: their profile, their last seven nightly summaries and their weekly trends, about 10 KB per user. 4 million × 10 KB = 40 GB, which fits on one large cache node or a few small ones, plus the cache's own overhead per entry, so leave room. Holding it can keep most of the 80 million daily reads off the database, since a user's later opens that day find what the first one loaded; if the working set outgrows memory, Cache eviction: TTL, LRU, LFU is what happens next.
Servers: capacity, then headroom
Servers are the peak divided by what one instance can take at the utilization you plan for, plus a spare. A load test shows one API instance handling at most about 400 requests a second; planning at 70%, 3,000 ÷ (400 × 0.7) ≈ 10.7, so 11, plus one spare: 12. Why the target is not 100% and what the spare is for is the job of Servers, not utilization, decide the queue.
Each box carries the figure that put it there. No CDN and no shards: nothing in the estimate asked for them.
Does the answer pass the smell test?
Last, hold the result against a bound it cannot cross. 80 million requests from 4 million users is 20 each a day, a few minutes of use: plausible. Had the arithmetic said 2,000 each, that would be one request every 43 seconds on average, around the clock, from every active user, and the first suspect is a slipped zero or two, not a bigger cluster. The recordings pass the same test: 100 TB a year is about 25 MB per active user, 219 nights of 115 KB, and a figure of 25 GB each would point to a mistake in units.
Let the simulation check your arithmetic
The URL Shortener challenge gives a 100:1 read-to-write ratio and leaves the rest to you, which makes it a fair test of an estimate. Work out requests a second, the peak, storage a year and the hot set before the first box, and write down what they predict: whether a cache is needed and how many app replicas carry the peak. The simulation then tells you whether the prediction holds, and a large miss usually has the same cause as a failed smell test. Diagnose: On-Sale Rush Hits the Booking Store tests the peak, a design with nothing between the crowd and its database meeting a 10x flash crowd, and in Video Streaming Platform bandwidth, not storage, is the number that shapes the design.