Skip to content

Back-of-the-Envelope Estimation

Basic 46 min read Part 2 of 18

Quick, rounded math for QPS, storage, bandwidth, cache size and server count, so you know which parts of a design actually need to scale.

Summary#

Back-of-the-envelope estimation is rough maths, done in a few minutes, that turns requirements into numbers:

  • requests per second (QPS), average and peak;
  • the split between reads and writes;
  • storage per year;
  • bandwidth in and out;
  • cache memory;
  • the number of servers, replicas and shards.

The goal is the right order of magnitude, not precision. Is it 100 or 100,000 requests per second? 10 GB or 10 PB? That is enough to decide whether you need a cache, a CDN, sharding or a queue.

The core tools are a few memorised conversions (a day is about 10⁵ seconds, 1 Gbps is about 125 MB/s) and a handful of formulas:

  • QPS = DAU × actions ÷ 86,400, multiplied by a peak factor.
  • Storage = writes × size × retention × replication.
  • Bandwidth = QPS × payload size.
  • Cache memory is roughly 20% of the daily read set, by the 80/20 rule.
  • Servers = peak QPS ÷ per-server capacity, plus headroom.

Every number should end with a sentence about what it means for the design. Skip estimation when the answer is obviously small.

Why It Exists#

Without numbers, design is guesswork:

  • "We need sharding" might be true at 100 TB of data and silly at 100 GB.
  • "One database is enough" might be true at 500 writes per second and false at 50,000.
  • "Put it in Redis" is fine for 20 GB of hot data and very expensive for 20 TB.

Estimation tells you which parts of the design actually need to scale, and which can stay simple. That is the real point: most components in most systems are small, and you want to spend your design effort, and your budget, on the few that are not.

The technique has a famous ancestor. The physicist Enrico Fermi was known for estimating quantities from almost no data by breaking them into factors he could guess. The classic exercise, "how many piano tuners are there in Chicago?", is now called a Fermi problem. The insight is that errors in independent guesses partly cancel. If you over-estimate one factor and under-estimate another, the product is often within a factor of two or three of the truth. That is good enough to choose between one database and fifty.

Estimation is also an engineering habit. Jeff Dean's well-known list of "latency numbers every programmer should know", from his talks at Google in the late 2000s, was meant exactly for this: quick calculations to compare designs before building them. See Numbers to Know.

You should estimate when a number could change the design. Skip it, or keep it to one line, when the answer is obviously small (an internal tool for 200 people) or when the interviewer tells you to move on.

How It Works#

The flow is always the same. Write down the inputs from the requirements, derive load, then derive resources, and finish with the design decision each number implies.

Powers of two and unit conversions#

Memorise a few anchors and round freely. Computers count in powers of two, but for estimation you can treat 2¹⁰ ≈ 10³.

Power of twoExact valueApprox.Name (binary / decimal)
2¹⁰1,02410³ (thousand)KiB / KB
2²⁰1,048,57610⁶ (million)MiB / MB
2³⁰~1.07 × 10⁹10⁹ (billion)GiB / GB
2⁴⁰~1.10 × 10¹²10¹² (trillion)TiB / TB
2⁵⁰~1.13 × 10¹⁵10¹⁵PiB / PB
2³²~4.3 × 10⁹4 billionRange of a 32-bit unsigned integer
2⁶⁴~1.8 × 10¹⁹18 quintillionRange of a 64-bit unsigned integer

The IEC prefixes (KiB, MiB, GiB) mean powers of two, while KB, MB and GB strictly mean powers of ten. The gap is 2.4% at KB and grows to about 10% at TB. That is irrelevant for estimates, but it explains why a "1 TB" disk shows up as about 931 GiB.

The 2³² row matters more than it looks. A 32-bit ID runs out at about 4 billion. Large systems that started with 32-bit IDs have had to migrate to 64-bit, so choose 64-bit IDs for anything that might grow. See Unique ID Generation.

Typical sizes to use as inputs:

ItemTypical size
A character (ASCII / UTF-8 Latin text)1 byte (UTF-8 non-Latin: 2-4 bytes)
An integer ID / timestamp4-8 bytes
A UUID16 bytes binary, 36 bytes as text
A tweet-length text post with metadata~0.5-1 KB
A JSON API response for one item~1-5 KB
A database row for a user profile~0.5-2 KB
A compressed photo (phone)~0.5-3 MB; thumbnails ~20-200 KB
One minute of 1080p video (streaming bitrate)~40-60 MB (about 5-8 Mbps)
One minute of audio (128 kbps)~1 MB
A web page (HTML + CSS + JS + images, first load)~1-3 MB

Time conversions:

PeriodSecondsRound to
1 hour3,600~4 × 10³
1 day86,400~10⁵
1 month~2.6 million~2.5 × 10⁶
1 year~31.5 million~3 × 10⁷

Rounding a day to 10⁵ seconds makes the maths easy. It is about 15% off, and it errs on the safe side, because dividing by a bigger number gives slightly lower QPS, which the peak factor then covers. A handy consequence: 1 million requests per day is about 10 requests per second on average, and 1 billion per day is about 10,000 per second.

Bits and bytes: network speeds are quoted in bits per second, and storage in bytes. Divide by 8:

  • 1 Gbps ≈ 125 MB/s;
  • 10 Gbps ≈ 1.25 GB/s;
  • 100 Gbps ≈ 12.5 GB/s.

Mixing the two is one of the most common estimation errors.

From users to queries per second#

Start from DAU (daily active users) and how many of each action a user performs per day. Use MAU (monthly active users) only if that is all you have. A typical DAU/MAU ratio for consumer apps is about 10-50%, with highly engaging social and messaging apps at the top of that range.

Average QPS   = DAU x actions per user per day / 86,400 (~10^5)
Peak QPS      = Average QPS x peak factor (usually 2-5x; 10x+ for events)
Read QPS      = total QPS x read share;  Write QPS = total QPS x write share
Storage/year  = writes per day x size per write x 365 x replication x overhead
Bandwidth     = QPS x average response (or upload) size
Cache memory  = ~20% of daily read data (80/20 rule), plus overhead
Servers       = Peak QPS / QPS one server can handle, plus headroom

Actions per user come from the product: feed views, messages sent, searches, page loads. Remember that one user action often causes several backend requests. One app screen may call 5-20 APIs, and each API may make several database or cache calls. Be explicit about which layer you are estimating. "10k page views/s" may mean "50k API calls/s" and "200k cache reads/s".

This request amplification is why the cache and the logging pipeline often see more traffic than the front door. Each layer needs its own number.

The peak factor. Traffic is never flat. Consumer traffic follows a daily (diurnal) cycle: low at night, peaking in the evening of the dominant time zone. A common rough rule is that the peak hour carries about 2-3x the average hourly traffic for a single-region audience. A global audience is flatter, because time zones overlap. On top of the daily cycle come:

  • Weekly and seasonal patterns: weekends; holidays for shopping; Sunday evenings for streaming.
  • Events: product launches, sports finals, Black Friday, New Year's Eve messages. These can reach 10x the average or more for minutes or hours.
  • Synthetic spikes: cron jobs firing on the hour, push notifications sent to millions of users at once (everyone opens the app in the next minute), and retry storms after an outage.

Use 2-3x for ordinary consumer apps, 5x when traffic is concentrated, and model events separately with their own numbers. For systems built around a single moment, such as ticket sales or flash sales, the "peak" is the whole problem and the daily average is meaningless.

Read vs write QPS#

Read vs write QPS matters because the two scale differently:

  • Reads scale with copies: caches, CDNs, read replicas. Adding a copy adds read capacity.
  • Writes must reach the authoritative store and every copy. They scale with partitioning (sharding), write-optimised storage engines, batching and queues.

Typical ratios by product type:

Product typeTypical read:writeWhy
Social feed, news, e-commerce browsing100:1 to 1,000:1Many viewers per item created
URL shortener100:1 or moreOne creation, many redirects
Chat / messaging~1:1 to 10:1Each message written once, read by a few recipients
Collaborative docs~1:1 to 10:1Frequent small edits
Metrics, logging, IoT telemetry1:10 to 1:1,000Constant writes; few reads, usually aggregated
Ride-hailing driver locationWrites dominateEvery driver pings every few seconds

A strongly read-heavy system points to caches and replicas. A write-heavy one points to LSM-based stores (Cassandra, ScyllaDB, RocksDB), partitioned logs (Kafka) and batching.

Storage per year#

Estimate storage per entity type, because different data goes to different stores:

  1. Size one record, field by field. For example, a post with id (8 B), user_id (8 B), created_at (8 B), a 300-character caption (~300 B), a location (16 B) and a media pointer (100 B) comes to about 450 bytes. Round up to 0.5-1 KB to cover column overhead and future fields.
  2. Multiply by records created per day and by days of retention.
  3. Add overhead:
    • Indexes: often 20-100% of the table size for OLTP tables.
    • Replication: usually 3 copies, so 3x. Object stores hide this in their price; databases you run yourself do not.
    • Storage engine overhead: free space, fragmentation, write-ahead logs. Plan for 1.2-1.5x.
    • Backups and snapshots, kept in separate storage.
  4. Account for growth. If users grow 2x a year, next year's daily writes double too. A 3-year storage estimate with doubling is about 1 + 2 + 4 = 7 times the first year, not 3 times.

Media (photos, video, audio, files) usually dwarfs everything else by two to four orders of magnitude, so estimate it separately. It belongs in object storage, not the database, which then holds only the metadata. Compression helps text and logs a lot (often 3-10x) and already-compressed media almost not at all.

Bandwidth#

Bandwidth is QPS times payload size. Do it separately for:

  • Ingress: data coming into the system, such as uploads, writes and telemetry.
  • Egress: data going out to users, such as pages, images and video. Egress is usually far larger, is often what you pay for on cloud bills, and is what a CDN offloads.

Express bandwidth in both bytes and bits, so you can compare with network links. A server NIC is often 10-25 Gbps; large instances have 50-100 Gbps or more. If the answer is "120 GB/s of egress" (about 1 Tbps), no single origin can serve it. You need a CDN with a high cache hit ratio, and the origin serves only the misses: at a 95% hit ratio, 5% of 120 GB/s is about 6 GB/s.

Also estimate internal bandwidth for heavy flows:

  • replication traffic (every write copied to replicas and other regions);
  • cache traffic (large values multiplied by high QPS);
  • service-to-service fan-out.

A large value read at high QPS can saturate a cache node's network before its CPU. 1 MB values at 10,000 reads/s are 10 GB/s, far beyond one node.

Cache memory with the 80/20 rule#

The 80/20 rule (the Pareto principle) says a small share of items gets most of the traffic. A common assumption is that caching the hottest ~20% of the data read each day serves most reads. To size the cache:

  1. Estimate the daily read set: the distinct items read per day times their size. Not total reads times size, because repeated reads of the same item need one cache entry.
  2. Take 20% of it, or the share that achieves your target hit ratio.
  3. Multiply by about 1.3-1.5 for per-key overhead (keys, pointers, fragmentation), then by the replication factor if cache shards have replicas.

The 80/20 split is a rule of thumb, but measured web workloads support the idea of heavy skew. Studies of web caching, such as Breslau and others' "Web Caching and Zipf-like Distributions" (IEEE INFOCOM, 1999), found that request popularity roughly follows a Zipf-like distribution: the item at rank k is requested in proportion to 1/k^α, with α typically below 1. Under such distributions the hit ratio grows roughly logarithmically with cache size. Doubling the cache adds a steady few points of hit ratio, not a doubling. So the first few percent of items give most of the benefit, and very large caches give diminishing returns.

When the cache is too large to be practical, check:

  • whether you can cache a smaller representation, such as IDs instead of full objects;
  • whether the hot set is really that big, since long-tail items are rarely worth caching;
  • whether the data belongs in a fast database rather than a cache.

Number of servers#

Divide peak QPS by what one server handles, then add headroom:

  • A typical stateless app server handles roughly 1,000-10,000 simple requests per second, depending on language, framework and work per request. Heavy work (rendering, ML inference, image processing) can drop this to tens or hundreds.
  • A better estimate uses CPU time per request. A server with 16 cores and a request that needs 4 ms of CPU can serve about 16 × 1000 / 4 = 4,000 requests/s at 100% CPU. At a target of 60%, that is about 2,400.
  • Requests that mostly wait on I/O are limited by concurrency rather than CPU. Little's law gives the in-flight count: QPS × latency. At 2,000 QPS and 200 ms latency, 400 requests are in flight, so you need at least 400 concurrent workers, threads or connections across the fleet.

Headroom:

  • Run CPU-bound tiers at about 50-70% of capacity at peak. Queueing delay rises sharply near 100%.
  • Survive the loss of a zone. With 3 zones, each zone must carry 50% of the load if one fails, so provision about 1.5x.
  • Leave room for deploys (some instances draining), cache-miss storms and growth until the next capacity review.

Apply the same method to other tiers:

  • Databases: writes per second against what one primary handles, roughly 5k-20k simple write transactions per second on good hardware. Data size against what one node can store and back up comfortably, often a few TB. Reads against replicas.
  • Caches: about 100k-200k operations per second per Redis instance, and memory per node.
  • Connection servers (WebSockets): often tens of thousands to a few hundred thousand concurrent connections per host, depending on memory per connection and message rates.
  • Workers: jobs per second × seconds per job ÷ concurrency per worker.
  • Kafka: partitions sized so each consumer instance can keep up, with total throughput spread across brokers.

These are rough figures; measure your own with load tests. See Numbers to Know.

Estimate just in time, and compare against thresholds#

There are two styles of estimation. In the upfront style you compute every number right after the requirements: QPS, storage, bandwidth, cache and servers. In the just-in-time style you skip the full sheet. You say "assume this is large", draw the design, and stop to calculate only when a decision depends on a number.

Many interviewers now prefer the second style. An upfront list of ten numbers takes five minutes, and often only one or two of them are ever used. The skill being tested is not mental arithmetic. It is whether you can see what a number implies: which architectures it rules in, and which it rules out.

How much estimation a problem needs depends on how deep the infrastructure challenge is:

  • Product-style problems, such as a booking site or a social app's profile page, usually need little. One line such as "a few thousand requests per second, which fits a handful of servers" is enough.
  • Infrastructure-heavy problems, such as a view counter, an ad-click aggregator, a metrics pipeline, a rate limiter or a top-K service, usually need real numbers. The write rate or the data size decides the whole architecture, and the interviewer will expect you to find that out.

The practical trick is to estimate against thresholds. You rarely need the exact value. You need to know which side of a known limit you are on:

QuestionRough thresholdIf above it
Write rate for one relational primary~10k simple writes/s (more with batching)Shard, batch, pre-aggregate or use a write-optimised store
Data on one database nodeA few TB is comfortable; tens of TB is possible but painful to back up and restorePartition, archive cold data, or move blobs to object storage
Hot data in one machine's RAMHundreds of GB is ordinary; a few TB exists on large instancesDistribute the cache, or cache a smaller representation
Operations on one Redis node~100k-200k simple ops/sShard the cache, or add replicas for reads
Egress from one serverOne NIC, often 10-25 GbpsCDN, more origins, or edge caching
Concurrent connections per hostTens of thousands to a few hundred thousandMore connection servers plus a routing layer

Thresholds turn estimation into a series of yes/no checks. They also make your reasoning easy to follow: "700k writes per second is seventy times what one primary takes, so a single database is out" is a sentence an interviewer can check in their head.

Three classic mistakes: premature sharding, pessimistic latency, over-built writes#

The most common estimation errors in interviews do not come from bad arithmetic. They come from out-of-date beliefs about what one machine can do. Three show up again and again.

Premature sharding. Candidates often shard a database that would fit comfortably on one node. A billion rows of 1 KB is 1 TB, which fits on one modern server with room to spare. A table of 4 billion IDs and counters (16 bytes each) is 64 GB, small enough to sit entirely in RAM. Sharding adds cross-shard queries, rebalancing and operational work. Do it when the estimate says you must, because writes, data size or availability isolation demand it, and not because the word "billion" appears in the prompt. See Partitioning and Sharding.

Pessimistic latency. Some candidates assume every database call costs 100 ms, then add caches everywhere to "fix" it. Within one data centre the real figures are much smaller:

  • reading from local memory: about 100 nanoseconds;
  • a random read from an NVMe SSD: about 0.1 ms;
  • a seek on a spinning disk: about 10 ms;
  • a Redis round trip in the same zone: well under 1 ms;
  • an indexed point lookup on a warm relational database: around 1 ms.

So a request that makes five sequential database calls spends about 5 ms on them, not half a second. Where latency really lives is in wide-area round trips (tens to over a hundred ms between continents), large fan-outs, cold caches, and queueing near saturation. The capacity side differs just as much. Memory serves millions of reads per second per node, an SSD on the order of 100k random reads per second, and a spinning disk only 100-200. That gap, not raw latency, is often the real reason to cache. See Numbers to Know.

Over-built writes. The opposite of premature sharding is building a Kafka-plus-Cassandra pipeline for 1,000 writes per second. One PostgreSQL or MySQL primary on NVMe with group commit handles thousands to tens of thousands of simple writes per second. One Kafka broker sustains hundreds of MB/s. Reach for write-scaling machinery only when the estimate crosses those lines. If it does, as in the view-counter example below, say so with the number.

How long does it take to move the data?#

Estimation is not only about steady-state load. Many design decisions depend on how long a one-off data movement takes: rebuilding a replica, restoring a backup, backfilling a new index, re-sharding or migrating to a new region. The formula is simple:

Time = data size / effective throughput
 
10 TB over 10 Gbps (1.25 GB/s), at full line rate : 8,000 s  = ~2.2 hours
Same, at a realistic 50-70% of line rate          : ~3-4.5 hours
1 PB over 10 Gbps                                 : ~800,000 s = ~9 days
Restore a 5 TB database at 500 MB/s from backup   : 10,000 s = ~3 hours, then replay the log
Re-process 100 TB with workers at 100 MB/s each   : 1M worker-seconds = ~3 hours with 100 workers

These numbers have direct design consequences:

  • Recovery time. If restoring the database takes three hours, your recovery time objective cannot be 15 minutes unless you keep a warm replica. See Availability and Reliability.
  • Exposure window. While a replica is being rebuilt, you are running with less redundancy. A second failure during that window can lose data. Larger nodes mean longer rebuilds and longer windows. This is one honest argument for more, smaller nodes.
  • Migrations. A petabyte cannot be copied over a single link during a weekend. Large migrations are either spread across many parallel streams, done incrementally with dual writes, or shipped physically. Cloud providers sell rugged storage appliances, such as AWS Snowball, for exactly this reason.
  • Re-sharding. Adding a shard moves about 1/N of the data. With 20 TB across 10 shards, adding one moves roughly 2 TB. At a throttled 100 MB/s, so that production traffic is not hurt, that is about 6 hours.

Key spaces and ID sizes#

Some systems need an estimate of how many identifiers they will ever create, and whether random IDs will collide. Two pieces of arithmetic cover most cases.

Code space. A short code made of base62 characters (a-z, A-Z, 0-9) has 62^n possible values:

LengthPossible codesLasts how long at 1,000 new codes/s
6 characters~5.7 × 10¹⁰about 1.8 years
7 characters~3.5 × 10¹²about 110 years
8 characters~2.2 × 10¹⁴thousands of years

At 1,000 new codes per second you create about 8.6 × 10⁷ a day and about 3 × 10¹⁰ a year, so 7 characters is the comfortable choice.

Collisions (the birthday bound). If you pick n random IDs from a space of N values, the expected number of colliding pairs is about n² / (2N). The chance of at least one collision reaches 50% when n is about 1.18 × √N. The surprise is how small n can be:

  • With 7-character random codes (N ≈ 3.5 × 10¹²), √N is about 1.9 million. After about 2.2 million codes, a collision is more likely than not. After 100 million codes, you expect over a thousand collisions. So random short codes need an insert-if-absent check and a retry. Alternatively, use a counter encoded in base62, which never collides.
  • A random version-4 UUID has 122 random bits (N ≈ 5.3 × 10³⁶). √N is about 2.3 × 10¹⁸, so collisions are not a practical concern.

Bit budgets for structured IDs. Twitter's Snowflake design, announced in 2010, packs a 64-bit ID as a millisecond timestamp, a machine number and a per-millisecond sequence. In its classic layout:

  • 41 bits of milliseconds is 2⁴¹ ms, or about 69 years from a chosen epoch;
  • 10 bits of machine ID allow 1,024 generators;
  • 12 bits of sequence allow 4,096 IDs per millisecond per generator, about 4 million per second.

Estimating a layout like this is part of the design. See Unique ID Generation.

Counters overflow. A signed 32-bit integer tops out at about 2.1 billion. At 1,000 inserts per second, that is about 25 days. Many production incidents have come from an auto-increment column or a counter quietly reaching that limit. When in doubt, use 64 bits.

Estimating fan-out#

Some workloads multiply on the way in. A news feed built with fan-out on write turns each post into one insert per follower:

Posts       : 50M DAU x 0.5 posts/day / 10^5     = ~250 posts/s avg
Feed writes : 250 posts/s x 200 avg followers   = ~50,000 inserts/s avg; x3 peak = ~150,000/s
Celebrity   : 1 post x 100M followers           = 100M inserts for one post
              at 1M inserts/s cluster-wide       = ~100 s of the whole cluster for one post

The average is manageable. The celebrity case is not, so the estimate itself points to the standard hybrid design: push posts to followers' feeds for ordinary authors, and pull celebrity posts at read time.

The same arithmetic applies to group chat (message rate × group size), notifications (event rate × subscribers) and event-driven systems (event rate × number of consumers). Always estimate the multiplied number as well as the input rate, and the largest single fan-out as well as the average.

When to Use It#

  • After requirements, before drawing the high-level design.
  • When deciding whether a component is needed at all (cache, shard, CDN, queue).
  • When choosing a database: total data size and write QPS rule options in or out.
  • When planning cost: storage and egress bandwidth often dominate cloud bills.
  • In design reviews: "where does this number come from?" catches many mistakes.
  • Before launches and events, to check whether each tier has headroom for the expected peak.

When NOT to Use It#

  • When the scale is obviously small; one sentence ("this fits on one server") is enough.
  • When precise numbers exist from production metrics; use real data instead of guesses.
  • In an interview, do not spend more than about five minutes; compute only numbers that change the design. Many interviewers prefer you to estimate later, when a specific decision depends on a number.
  • Do not build a precise capacity plan on rough estimates. For budgets and hardware orders, use measured per-server capacity and real traffic curves.

How to Implement It#

  1. Write the inputs: DAU, actions per user, record sizes, read/write ratio, retention, growth rate.
  2. Round aggressively: 86,400 becomes 10⁵; 2.7 becomes 3; 365 becomes 400 if it makes the maths easier (say so).
  3. Compute QPS (average and peak, reads and writes), then storage, bandwidth and cache.
  4. Sanity-check each number against known limits: one database primary, one NIC, one Redis node.
  5. State the design impact of each number in one sentence.
  6. Find the hot spots: the largest key, the busiest partition, the celebrity user.
  7. Revisit the inputs that most affect the answer, using ranges if unsure.

Worked example: a photo-sharing app#

Inputs: 50M DAU; each views 20 feed pages/day and uploads 0.2 photos/day.
        Feed page response ~50 KB (metadata); photo ~2 MB; keep forever.
Feed reads : 50M x 20 / 10^5          = 10,000 QPS avg; peak x3 = 30,000 QPS
Uploads    : 50M x 0.2 / 10^5         = 100 QPS avg;    peak x3 = 300 QPS
Read:write : ~100:1  -> cache + replicas, writes fit on one primary
Photo storage/day : 10M photos x 2 MB = 20 TB/day
Photo storage/year: 20 TB x 365       = ~7 PB/year (before replication)
Metadata/year     : 10M x 1 KB x 365  = ~3.7 TB (x3 replicas, + indexes ~15 TB)
Egress (photos)   : assume 20 photos per feed page at ~200 KB thumbnail
                    30,000 QPS x 20 x 200 KB = ~120 GB/s (~1 Tbps) at peak
Origin egress     : CDN hit ratio 95% -> ~6 GB/s from object storage
Cache (feeds)     : 50M users x 50 KB x 20% = ~500 GB (x1.4 overhead ~700 GB)
App servers       : 30,000 peak QPS / ~2,000 per server = 15, run ~25-30

The conclusions:

  • Photos: object storage behind a CDN. 7 PB a year is far beyond any database, and 1 Tbps of egress needs edge caching.
  • Feeds: a distributed cache of about 700 GB, so a small Redis cluster of perhaps 10-15 nodes with replicas.
  • Metadata: about 4 TB a year of raw rows, around 15 TB with replicas and indexes. It fits a large single primary for a year or two; plan sharding by user ID for later.
  • Uploads: about 300 per second at peak. A small write load for the database, though each upload triggers resizing work, which belongs on a queue.
  • App tier: about 25-30 servers across three zones, with autoscaling.

Worked example: a chat application#

Inputs: 100M DAU; 40 messages sent per user per day; avg message 200 B text
        (+ ~300 B metadata); 2 recipients on average (mostly 1:1, some groups);
        keep messages 1 year; 30% of users online at peak.
Writes     : 100M x 40 / 10^5         = 40,000 msgs/s avg; peak x3 = ~120,000/s
Deliveries : 120,000 x 2 recipients    = ~240,000 pushes/s at peak
Storage    : 4B msgs/day x 500 B       = 2 TB/day -> ~730 TB/year, x3 = ~2.2 PB
Connections: 30M concurrent WebSockets / ~100k per host = 300 hosts (+ headroom)
Bandwidth  : 240,000/s x ~1 KB framed  = ~240 MB/s (~2 Gbps) to clients: small

The conclusions:

  • Messages: a write-heavy store holding petabytes across replicas, partitioned by conversation. This suggests a wide-column store such as Cassandra or ScyllaDB rather than a single SQL primary.
  • Connections: hundreds of connection servers, with a routing layer to find which server holds each user.
  • Bandwidth: modest, so the hard parts are storage and connection management. See Design a Chat System.

Notice how different the bottlenecks are. The photo app is dominated by egress and media storage, the chat app by write rate, storage and connection count. That is exactly what estimation is for.

Worked example: a URL shortener (when the answer is small)#

Not every estimate ends with "we need sharding". A URL shortener is a good example of an estimate that keeps the design simple.

Inputs: 10M new links/day; 100 redirects per link on average (100:1 read:write);
        link row ~500 B (long URL, code, owner, timestamps, expiry, index share);
        keep links 5 years; redirect response ~500 B (a 301/302 plus headers).
Writes    : 10M / 10^5             = 100/s avg;     peak x3  = ~300/s
Reads     : 1B redirects / 10^5    = 10,000/s avg;  peak x3-5 = ~30-50k/s (viral links)
Storage   : 10M x 500 B            = 5 GB/day -> ~1.8 TB/year -> ~9 TB in 5 years (x3 replicas)
Codes     : 5 years x 3.65B/year   = ~1.8 x 10^10 links -> 7 base62 chars (3.5 x 10^12)
Cache     : ~50M distinct links/day x 500 B = 25 GB; hot 20% = ~5 GB (x1.4 = ~7 GB)
Bandwidth : 50k/s x 500 B          = ~25 MB/s (~200 Mbps): trivial

What the numbers say:

  • Writes are tiny. 300 per second at peak is a small fraction of one primary.
  • Data is about 9 TB after five years. A single node holds the first couple of years easily. Partitioning is a later decision, made when the data approaches a few TB per node, not on day one.
  • Reads are the only large number, and they are very skewed toward recent and viral links. A cache of under 10 GB fits in one Redis node. Running a primary and a replica for availability serves hundreds of thousands of reads per second, several times the peak.
  • Latency: a cache hit costs well under a millisecond inside the data centre, and a miss to an SSD-backed database a few milliseconds. The redirect is dominated by the user's own network round trip, not the backend.
  • Codes: 7 characters are enough for over a century at this rate. Random codes need an insert-if-absent check (see the birthday bound above); a counter-based scheme avoids collisions entirely.

So the design is a handful of stateless servers, one database with a replica, and a small cache. The interesting problems are elsewhere: generating unique short codes, handling a link that goes viral, and abuse. The estimate's job here is to prove that scale is not the hard part, which saves the time you would otherwise waste on sharding.

Worked example: counting video views for a top-K list (when writes dominate)#

Now the opposite case. A video platform wants to show the most-viewed videos over the last hour, day, month and all time. Every view must be counted.

Inputs: 70B views/day; about 1 hour of new video uploaded every second;
        average video ~6 minutes; keep counts for 10 years.
Writes   : 70B / 10^5                     = 700,000 view events/s on average
Videos   : 3,600 s of content per s / 360 s per video = 10 new videos/s
           10/s x 10^5 s/day             = 1M videos/day
           1M x 365 x 10 years           = ~3.6B videos (round to 4B)
Counters : 4B x (8 B id + 8 B count)     = 64 GB

Notice that the 100,000-seconds-per-day shortcut does real work here. Using 86,400 would change nothing except make the mental maths slower.

The striking result is the contrast between the two big numbers. The data is small: 64 GB of counters fits in the RAM of one machine. The rate is huge: 700,000 writes per second is about seventy times what one relational primary handles with single-row updates. So this is a write-throughput problem, not a storage problem. Keep that 64 GB figure in mind, because every structure that holds a count per video will need at least that much space.

Step 1: shard the writes. View events arrive on a log such as Kafka, partitioned by video ID. Shard the counter database by the same key, so each consumer writes only to its own shard. At about 10k writes per second per shard, that needs around 70 shards. That works, but it is a lot of databases for one integer per video.

Sharding breaks the single ORDER BY views DESC LIMIT K query. The fix is to ask each shard for its own top K and merge the lists. This is exact, not approximate. Suppose a video is in the global top K but not in its own shard's top K. Then at least K videos in that shard have more views, and all of them would rank above it globally, so it could not be in the global top K. That contradiction means the global top K is always contained in the union of the per-shard top-K lists.

Step 2: batch and pre-aggregate. Views are very skewed. In any minute, a large share go to a few thousand popular videos. Instead of one write per view, a stream processor such as Apache Flink can sum views per video per window and write one row per video per window. Flink checkpoints its state together with the Kafka offsets, so after a crash it rewinds to the last checkpoint and replays, without losing or double-counting events. A watermark strategy that tolerates bounded out-of-order arrival, for example waiting up to about 30 seconds for late events, handles stragglers.

How much does pre-aggregation save? It depends on how many distinct videos are viewed per window. As an assumption to state out loud: in an hour there are about 2.5 billion views, which might touch roughly 100 million distinct videos. Then hourly windows cut writes by about 25x. A reasonable range across window sizes and skew is 2-100x. The writes also change shape. Instead of a steady trickle of single-row updates, each shard receives a bulk load once per window, and databases absorb bulk writes far more efficiently. Together, this brings the shard count down to somewhere around 5-10.

Step 3: question the store itself. Since all counters fit in 64 GB, another option is to keep them in memory inside the stream processor or a Redis cluster, and snapshot them to durable storage. At that point the estimate has led you from "a database with 70 shards" to "a stream processor plus a few nodes", which is a far cheaper design.

The lesson is the one worth saying in an interview. The arithmetic took a minute. What mattered was noticing that rate, not volume, is the bottleneck, and that skew lets you collapse the rate before it reaches storage.

Worked example: a video streaming service (when egress dominates)#

The third shape of answer is a system whose cost and difficulty are almost entirely in bandwidth out.

Inputs: 200M DAU; 60 minutes watched per user per day; average delivered bitrate 5 Mbps
        (a mix of phones and HD TVs); 500k uploads/day, average 8 minutes long.
Viewers    : 200M x 60 min / 1,440 min       = ~8.3M concurrent on average; x3 peak = ~25M
Egress     : 25M x 5 Mbps                    = ~125 Tbps at peak
Uploaded   : 500k x 8 min                    = 4M min = ~67k hours of video per day
Renditions : full bitrate ladder sums to ~15 Mbps per second of video
             3,600 s x 15 Mbps / 8           = ~6.75 GB per hour of source
Storage    : 67k hours x 6.75 GB             = ~450 TB/day -> ~165 PB/year (+ masters, + redundancy)
Ingress    : 67k hours x 3,600 s x 10 Mbps / 10^5 s = ~24 Gbps on average
Metadata   : 500k videos x 5 KB              = 2.5 GB/day: tiny
Transcode  : assume ~10 CPU-hours per hour of source for the whole ladder
             67k x 10 = 670k CPU-hours/day   = ~28k cores busy around the clock

What the numbers say:

  • Egress is about 125 Tbps at peak, roughly 5,000 times the ingress. No origin cluster can serve that. Video must come from a CDN, ideally with caches placed inside internet providers' networks, close to viewers. A well-tuned cache server can push on the order of 100 Gbps, so even at full speed this needs well over a thousand edge servers, and in practice several thousand once you add headroom and geographic spread. See CDN.
  • Storage grows by well over 100 PB a year. That is object storage with tiering: popular renditions on fast storage, the long tail in colder classes. See Object Storage.
  • Transcoding is a large, steady batch workload of tens of thousands of cores. It belongs behind a queue with autoscaled workers, and its cost depends heavily on codec choice. Newer codecs save egress but cost much more CPU to encode. That trade-off is itself an estimate: compare the extra encoding cost with the bandwidth saved across all future views of the video.
  • Metadata is a few GB a day, an ordinary database problem.

Three worked examples, three different bottlenecks: reads that fit in one cache, writes that need aggregation, and egress that needs a global edge network. The method was the same each time.

TechnologyFits when
A spreadsheetReal capacity planning with growth scenarios and sensitivity analysis
Cloud pricing calculators (AWS, GCP, Azure)Turning storage, compute and egress into monthly cost
Load tests (k6, Locust, Gatling, wrk2)Replacing guessed per-server capacity with measured numbers
Production metrics (Prometheus, CloudWatch, Datadog)Real traffic curves, peak factors and payload sizes

Trade-offs#

ApproachProsConsPick when
Rough, rounded mathsFast; enough for most decisionsCan miss a factor of 2-3Interviews, early design
Ranges (low/high)Shows which assumptions matterSlightly more workUncertain inputs that may change the design
Detailed modelAccurate cost and capacitySlow; needs real dataBudget approval, launches
Measure in productionGround truthOnly exists after launchScaling an existing system
Load testReal per-server capacityNeeds realistic traffic and dataBefore launches, after big changes
Upfront estimate sheetCovers everything; good for reviewsSlow; many numbers never usedDesign documents, capacity reviews
Just-in-time estimateOnly computes what changes a decisionCan miss a number nobody thought to checkInterviews, product-style problems
Threshold checkSeconds per decision; easy to followNeeds up-to-date thresholdsChoosing between one node and many
Skew-aware estimate (Zipf, top key)Finds hot keys and hot partitionsNeeds an assumed or measured distributionCounters, caches, celebrity and viral content
Data-movement estimateSets realistic recovery and migration timesEffective throughput is often lower than line rateBackups, replica rebuilds, migrations, re-sharding

Common Pitfalls#

These mistakes most often lead to wrong designs:

  • Forgetting the peak factor. Average QPS hides the spikes that actually break systems.
  • Mixing bits and bytes: network links are quoted in bits per second (1 Gbps is about 125 MB/s).
  • Ignoring replication, indexes and overhead in storage, which can triple the total or more.
  • Confusing user actions with backend requests. One page view can be dozens of internal calls.
  • Sizing the cache from total reads instead of distinct items read.
  • Forgetting growth: sizing for today's load when the system must last three years.
  • Over-precision: computing 57,870.37 QPS instead of "about 60k".
  • Sizing to 100% utilisation, leaving no room for failover, deploys or spikes.
  • Ignoring hot spots: totals look fine while one partition or key melts.
  • Computing numbers and then not using them. Every number should lead to a design decision.
  • Premature sharding: splitting a dataset that fits on one node, or even in one machine's RAM.
  • Pessimistic latency: assuming 100 ms per database call inside a data centre, when 1 ms is typical.
  • Over-built writes: adding Kafka and a wide-column store for a few thousand writes per second that one primary handles.
  • Confusing volume with rate: a 64 GB dataset can still need a distributed design at 700k writes per second.
  • Forgetting data-movement time: restores, replica rebuilds and migrations that take hours or days.
  • Using random short IDs without the birthday bound: collisions arrive after about √N IDs, not N.
  • Ignoring multiplication: fan-out, retries, and synchronised clients that turn a modest input rate into a large one.

Real-World Examples#

Typical scenario: a team plans a logging pipeline. Estimation shows 2 TB of logs per day. That rules out keeping a year in a search cluster (about 730 TB before replicas). The resulting design keeps 14 days of logs searchable in OpenSearch (about 28 TB, around 60 TB with replicas) and archives the rest to object storage in a compressed columnar format for occasional queries.

Typical scenario: a startup expects 1 million users and considers sharding. Estimation shows 200 writes per second at peak and 500 GB of data after two years. One managed PostgreSQL instance with a replica covers it, and the team spends the saved effort on the product.

Jeff Dean's "numbers everyone should know" slides, presented in talks at Google and elsewhere around 2009, popularised exactly this style of quick calculation, for example estimating how long it takes to generate a page of image thumbnails under different designs.

Typical scenario: a team designs a view counter and starts with "one row update per view" in a relational database. A two-line estimate gives 700,000 events per second, against a 64 GB counter table that would fit in memory. That changes the design to a stream processor that pre-aggregates per window, writing bulk updates to a handful of shards. The estimate saves both a 70-shard cluster and a later incident.

Typical scenario: a team plans to migrate 800 TB to a new region over "a weekend". The estimate says otherwise. 800 TB over a 10 Gbps link at 60% utilisation is about 12 days. The plan becomes an incremental copy, started weeks in advance, with change capture to keep it current and a short cut-over at the end.

Netflix built its own CDN, Open Connect, and places caching appliances inside internet providers' networks. At video scale, the egress estimate makes this kind of investment rational. Serving tens of terabits per second from a few central regions would be both slow and very expensive.

Twitter's Snowflake ID scheme, published in 2010, is a small exercise in estimation: a bit budget split between a millisecond timestamp, a machine number and a sequence. That budget fixes how many years the IDs last, how many generators can run and how many IDs each can issue per millisecond.

In the Interview#

Which number matters, by problem type#

Each classic interview problem has one or two numbers that decide the design. Knowing them in advance tells you where to spend your estimation minutes:

ProblemThe number that mattersWhy it decides the design
URL shortenerRead QPS and code spaceShows that one database plus a cache is enough, and how long codes must be
Top-K / view counterWrite events per second700k/s rules out one row update per view; points to sharding and pre-aggregation
Ad-click aggregatorClicks per second and dedup windowWrite rate plus exactly-once counting shape the stream pipeline
Chat / messagingConcurrent connections and messages per secondSizes the connection fleet, routing and the message store
News feedPosts per second × followersFan-out cost; the celebrity case forces a hybrid design
Video streamingPeak egressOnly a CDN can serve it; storage and transcoding follow
File sync (Dropbox-like)Storage and upload bandwidthChunking, deduplication and object storage
Ride-hailingLocation updates per secondDrivers ping every few seconds: a write-heavy geo index
Ticket salesPeak burst at the on-sale momentThe average is meaningless; size for the spike and add a queue
Search / typeaheadQPS per keystroke and index sizeEvery keystroke is a request; the index must fit in memory or be sharded
Rate limiterChecks per second and keys in memoryEach request costs a counter update; memory per key × active keys
Metrics / loggingIngest bytes per second and retentionHot vs cold storage tiers; compression ratios matter

A two-minute estimate, spoken#

Here is roughly what a good spoken estimate sounds like for a chat system. It takes under two minutes:

  1. State the inputs. "I'll assume 100 million daily users sending about 40 messages a day."
  2. Compute and round. "That's 4 billion messages a day. Divided by 10⁵ seconds, about 40,000 per second on average, so around 120,000 at peak."
  3. Compare with a threshold. "That's well beyond one relational primary, so messages go in a partitioned, write-friendly store, keyed by conversation."
  4. Do the second number only if it matters. "Storage: 4 billion times about 500 bytes is 2 TB a day, about 700 TB a year before replication. That confirms a distributed store, with a retention policy."
  5. Name the hot spot. "The biggest single unit is a large group. A 1,000-member group turns one message into 1,000 deliveries, so groups get their own fan-out path."
  6. Move on. "Connections and bandwidth I'll check when we get to the gateway."

The structure is the same for every problem: inputs, rounded maths, threshold, design consequence, hot spot. Interviewers listen for the consequence and the hot spot more than for the arithmetic.

Handling interviewer pushback. If the interviewer gives different numbers, redo only the line that changes and say what it changes: "At 10 messages a day instead of 40, peak writes are about 30k per second. That is still above one primary, so the design holds." If they ask you to skip estimation entirely, say one sentence about which number you would watch and continue.

Deep Dive: Making estimates trustworthyShow

Use ranges for uncertain inputs. If you are unsure whether users upload 0.1 or 1 photo a day, compute both. If the design is the same either way, move on. If not, you have found the assumption to confirm with the stakeholder. This is a simple form of sensitivity analysis: find which input moves the answer most.

Why rough estimates work (and when they do not). In a product of several estimated factors, errors in independent factors partly cancel. If each factor is equally likely to be 2x too high or 2x too low, the typical error of a five-factor product is about 2^√5 ≈ 4.7x, not 2⁵ = 32x. That is because errors on a logarithmic scale add like a random walk. This is why Fermi estimates usually land within an order of magnitude. The trick fails when errors are correlated, for example when you are optimistic about everything at once. It also fails when one factor is wildly wrong, such as assuming 1 KB per event when it is really 100 KB because of embedded payloads. Check the biggest factor most carefully.

Check against the shape of traffic. Daily peaks are typically 2-3x the average, but events (sales, sports finals, New Year messages) can reach 10x or more for minutes. Systems with a hard deadline, such as ticket drops or exam results, must be sized for the deadline, not the day.

Little's law sizes concurrency. The number of in-flight requests equals the arrival rate times the time in the system. At 30,000 QPS and 100 ms per request, about 3,000 requests are in progress at any time. That sizes thread pools, connection pools and the connection limits of the database. If database latency doubles during an incident, in-flight requests double too, which is how slow dependencies exhaust pools.

Cost is an estimate too. At large scale, egress bandwidth and storage dominate bills. 120 GB/s of egress is roughly 300 PB a month. Even at a fraction of a cent per GB, that is a very large bill, which is why large video and image services negotiate CDN contracts or build their own edge networks.

Estimate the hot spots, not just totals. A celebrity with 100 million followers turns one post into 100 million feed updates. Total QPS may look fine while one key or partition melts. Always ask what the largest single unit of load is: the biggest key, tenant, chat group or partition.

Deep Dive: From estimates to a capacity planShow

In a real organisation, the interview-style estimate becomes the first draft of a capacity plan. A good plan replaces each guessed number with a measured one and adds time.

  1. Measure demand. Take traffic per endpoint from production metrics, with the daily curve, the weekly pattern and the busiest days of the past year. Compute the real peak-to-average ratio and the real payload sizes.
  2. Measure supply. Load-test one instance of each tier with production-like data and request mix. Find the throughput at which p99 latency crosses the SLO. That is the instance's real capacity, which is usually lower than its maximum throughput.
  3. Forecast. Project demand forward using business growth plans plus known events, such as marketing campaigns, launches and seasonal peaks. Keep low, expected and high scenarios.
  4. Add headroom and redundancy.
    • Target utilisation at forecast peak (for example 60%).
    • N+1 or N+2 for zone or region loss.
    • Lead time for new capacity: minutes for autoscaling groups, weeks for reserved instances or hardware.
  5. Find the limiting resource per tier: CPU, memory, disk IOPS, network, connections, or a quota (API rate limits, cloud account limits, partition counts). Many outages are caused by a forgotten limit rather than raw CPU: open file descriptors, a NAT gateway's connection table, a managed service's request quota.
  6. Review regularly, typically quarterly, and after any large change in traffic or code.

The step from 2 to 4 is where queueing theory matters. As utilisation ρ approaches 1, waiting time grows like ρ/(1 − ρ) in simple models:

  • at 50% utilisation, waiting adds about 1x the service time;
  • at 80%, about 4x;
  • at 90%, about 9x;
  • at 95%, about 19x.

That is why a server "at 90% CPU" often violates its latency SLO even though it is not technically overloaded, and why capacity plans target 50-70%.

Google's SRE book describes intent-based capacity planning: teams state requirements such as "serve 10k QPS at p99 < 200 ms with N+2 redundancy across regions", and tooling works out the resources. The principle applies at any size. Write the requirement, measure the per-instance capacity, and let simple arithmetic produce the plan.

Deep Dive: Skew, hot keys and the Zipf arithmeticShow

Totals hide the busiest key. Skew is estimable too, using the same Zipf-like model that explains cache hit ratios.

The Zipf model. Under a Zipf distribution with exponent α = 1, the item at popularity rank k gets a share of traffic proportional to 1/k. With N items, the shares are 1/(k × H_N), where H_N = 1 + 1/2 + ... + 1/N is the N-th harmonic number. H_N is about ln N + 0.577. This gives some useful closed-form estimates.

Share of the single hottest item. With N = 1 million items, H_N ≈ 14.4, so the top item gets about 1/14.4 ≈ 7% of all requests. With N = 4 billion videos, H_N ≈ 22.7 and the top item gets about 4.4%. Apply that to the view counter: 4.4% of 700,000 events per second is about 31,000 events per second for one video. That is more than one row can take as individual updates in most databases, because every update to the same row is serialised by its lock.

The standard fixes follow from the estimate:

  • Split the counter. Store k sub-counters per hot key, have each write pick one at random, and sum them on read. With k = 10, each sub-counter sees about 3,100 writes per second.
  • Aggregate first. Pre-aggregation in a stream processor turns 31,000 events per second into one write per window.
  • Cache reads at the edge. For read hot keys, a short TTL cache in each app server absorbs most of the load before it reaches the shared cache.

Share of the top C items, and the cache hit ratio. The share of traffic going to the top C items is H_C / H_N. With N = 1 million and α = 1:

Cached share of itemsItems cached (C)H_CHit ratio (H_C / H_N)
1%10,000~9.8~68%
10%100,000~12.1~84%
20%200,000~12.8~89%
50%500,000~13.7~95%

Two lessons follow. First, the "cache 20%, serve about 80-90%" rule of thumb is roughly what α = 1 predicts for a million items. Second, the hit ratio grows by ln 2 / H_N, about 5 percentage points, each time the cache doubles. That is the logarithmic growth described earlier, now with a number attached.

Measured web workloads are often a little flatter than α = 1. Breslau and colleagues reported exponents mostly between about 0.6 and 0.8 for the proxy traces they studied. A flatter distribution means a lower share for the top item and a bigger cache for the same hit ratio. If the hit ratio drives a big cost, measure the real distribution instead of assuming one.

Randomness at low rates. Arrivals that are independent and random behave roughly like a Poisson process. If the average is λ requests per second, the count in a given second has a standard deviation of about √λ. A busy second is roughly λ + 3√λ:

  • at 10,000 per second, a busy second is about 10,300, only 3% above average;
  • at 10 per second, a busy second is about 20, double the average.

Small services and individual keys are therefore much burstier, relative to their average, than large aggregates. This matters for per-key rate limits, per-tenant quotas and small worker pools. Correlated bursts (everyone reacting to the same event) are much larger than Poisson noise and must be modelled separately, as below.

Partition imbalance. Hash partitioning spreads keys evenly but not load. The hottest partition carries its fair share plus the hottest key it contains. When one key carries 4% of the traffic and there are 50 partitions with a 2% fair share each, the partition that holds the hot key carries about 6%, three times the average. Size each partition for the hottest one, not the mean. See Partitioning and Sharding.

Deep Dive: Peak factors from first principlesShow

"Multiply by 3 for peak" is a rule of thumb. When the peak matters, you can estimate it from the shape of traffic instead.

The daily curve. Suppose a single-region audience produces traffic that swings smoothly between a night-time trough at 20% of peak and the evening peak. A sine-like curve averages to the midpoint, so the average is 60% of the peak and the peak is about 1.7 times the average. Real curves are not symmetrical. A short evening bulge on a long flat day makes the peak-to-average ratio higher, typically 2-3x. A global audience overlaps time zones and flattens the curve, often to well under 2x for the global total, while each region still has its own peak.

Notification-driven spikes. A push notification to 10 million users is a planned spike:

Opens        : 10M x 5% open within the first minute    = 500k opens
App launch   : each open makes ~10 API calls            = 5M API calls
Spread       : most opens land in the first ~20 seconds = ~250k API calls/s
Baseline     : if normal traffic is 30k API calls/s, the spike is ~8x

The fixes are cheap once the number is known: send notifications in waves, add jitter, and pre-warm caches for the content they link to.

Synchronised clients. Devices that "sync every hour on the hour" create a spike every hour. One million devices syncing within the same few seconds produce hundreds of thousands of requests per second, against an average of under 300. Adding random jitter to each client's schedule spreads the same work over the whole hour. The estimate is the argument for adding it.

Retries amplify overload. If clients retry up to 3 times on failure, a backend that starts failing can receive up to 4 times the normal load at the worst moment. A 50% failure rate with 3 retries gives 1 + 0.5 + 0.25 + 0.125 ≈ 1.9 times the load. Retry budgets, exponential backoff with jitter, and circuit breakers keep that factor near 1. See Latency, Throughput and Performance.

Moment-driven systems. For ticket sales, the peak is the design. If 2 million fans are waiting when sales open at 10:00, and each page refreshes every 2 seconds, the front end sees about 1 million requests per second. The inventory service may handle only a few thousand reservations per second. That gap, about 300x, is the reason for a virtual waiting room that admits users at the rate the back end can sustain.

Seasonal and growth peaks. Retail peaks on a few days a year, tax software in one season, and sports streaming during finals. Plan capacity for the busiest expected day of the next planning period, including growth, not for this month's average. A system growing 5% a month has grown about 80% in a year. The peak you must survive next December is larger than this December's.

Deep Dive: Turning the estimate into a costShow

The last step of many real estimates is money. The method is to convert each resource into a monthly figure with unit prices, then find the biggest line. Prices change and vary by provider, region, commitment and volume, so look them up before you use them in a real plan. The structure of the calculation is what lasts.

Storage. Standard object storage at major clouds lists at roughly two cents per GB-month for the hot tier, with infrequent-access and archive tiers several times to about twenty times cheaper. After its first year, the photo app holds about 7 PB, or 7 million GB. At hot-tier list prices that is on the order of $150k a month, and it keeps growing because photos are kept forever. Moving older photos to colder tiers once their read rate falls is often the single biggest saving. That decision is itself an estimate: storage saved versus retrieval fees on the remaining reads.

Egress. Internet egress from a cloud region lists at several cents per GB for small volumes, falling at higher tiers. CDN prices at large committed volumes are much lower per GB. 120 GB/s for an hour is 432 TB. That is why a photo or video service's bill is usually dominated by egress, and why large media companies negotiate CDN contracts or run their own edge.

Compute. Price servers as instance-hours: count instances at peak, then average across the day if autoscaling follows the curve. A fleet that needs 30 instances at peak but 12 at night costs about 20 instance-days a day, not 30.

Memory. RAM is the most expensive resource per GB in most designs. A 700 GB cache costs far more per GB than 700 GB of SSD. That is why caching a compact representation (IDs instead of objects, compressed values) is worth an estimate.

Unit economics. Divide the monthly total by the business unit: cost per thousand users, per order, per stream hour or per message. A number like "a tenth of a cent per hour streamed" can be compared with revenue per hour. That comparison, not the absolute bill, tells you whether a design is viable. See Non-Functional Requirements.

Key Takeaways#

  • Estimation turns requirements into numbers that justify, or rule out, caches, replicas, shards, queues and CDNs.
  • Round a day to about 10⁵ seconds and aim for the right order of magnitude, not precision; 1M requests/day is about 10/s.
  • Compute average and peak QPS, and be clear whether you are counting user actions, API calls or database queries.
  • Split reads from writes: reads scale with copies, writes with partitioning, batching and write-optimised storage.
  • Estimate storage per entity, including indexes, replication, overhead and growth; keep media separate in object storage.
  • Estimate bandwidth for ingress and egress in bits and bytes, and compare it with NIC and CDN limits.
  • Size caches from the distinct daily read set using the 80/20 rule, and remember hit ratio grows only slowly with size.
  • Size servers from per-instance capacity at 50-70% utilisation, with N+1 zone headroom and Little's law for concurrency.
  • State the design decision each number leads to, and look for hot spots, not just totals.
  • Estimate just in time, against thresholds: you usually need to know which side of a limit you are on, not the exact value.
  • Do not shard what fits on one node, do not assume 100 ms database calls, and do not build write pipelines for loads one primary absorbs.
  • Separate rate from volume: the view counter has small data but a huge write rate, so pre-aggregation beats 70 shards.
  • Estimate skew with Zipf: the hottest of a million items can take about 7% of traffic, and doubling a cache adds only a few points of hit ratio.
  • Estimate data-movement time (size ÷ effective throughput) to set realistic recovery, rebuild and migration plans.
  • Check ID spaces with 62^n and the birthday bound, and use 64-bit counters.
  • Multiply through fan-out, retries and notification spikes, and plan for the largest single unit of load.