📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

๐Ÿ“š Interview question

Walk me through a capacity estimate: from daily active users to requests per second, storage and bandwidth, including peak factors. Use a worked example, show the arithmetic, and tell me how the numbers change your design.

Back-of-the-envelope capacity estimation: DAU to average and peak requests per second, storage per year, bandwidth and cache size, with useful rounding numbers and how the result drives design choices.

Intermediate Theory Intermediate back-of-the-envelope capacity-estimation performance scalability storage system-design

๐ŸŽฏ Key points

  • A day has ~86,400 s; round to 100,000 (10^5) for quick maths
  • Requests/s = DAU × actions per user per day ÷ 86,400
  • Peak factor 2–10× average depending on traffic shape (often 3× for business apps)
  • Storage/year = writes/day × record size × 365, plus replication and indexes
  • Bandwidth = requests/s × payload size; separate ingress and egress
  • Cache sizing: hot set (e.g. 20% of items serve 80% of reads)
  • Compare against known capacity of one instance or database to decide scale-out
  • Round aggressively and state the assumption behind every number

โฑ 30-second answer

A capacity estimate turns user numbers into load. Start with daily active users ร— actions per user to get requests per day, divide by ~86,400 s (round to 10^5) for average requests/s, then multiply by a peak factor (2โ€“10ร—, often 3ร—). For storage, multiply writes per day by record size and 365, then add indexes and replicas. For bandwidth, multiply requests/s by payload size.

Example: 10M DAU ร— 20 reads = 200M reads/day โ‰ˆ 2,300/s average, ~7,000/s peak.

The point is not precision โ€” it's deciding whether one database and a cache are enough or you need partitioning. The trade-off is speed versus accuracy: round hard, but state every assumption.

๐Ÿ—ฃ Full answer (senior)

How I would answer this in an interview

"I keep estimates to about three minutes and a few lines on the board. I start from daily active users and what each user does per day, separately for reads and writes because they hit different parts of the system. Requests per day divided by 86,400 gives the average rate โ€” I round 86,400 to 100,000 to keep the maths mental, which slightly under-counts, and that's fine. Then I apply a peak factor: consumer apps are spiky in the evening, business apps cluster in working hours, so I usually use three times average and say so.

Say we're designing a photo-sharing feed with 10 million daily actives. Each user views 50 posts and uploads 0.2 photos a day. That's 500 million reads a day, around 5,000 a second average and 15,000 at peak; and 2 million uploads a day, about 20 a second, 60 at peak. If metadata is 1 KB and a photo averages 2 MB, metadata grows 2 GB a day โ€” under a terabyte a year โ€” while photos grow 4 TB a day, about 1.5 PB a year. That immediately tells me metadata fits in a relational database, photos go to Blob Storage behind a CDN, and the read path needs caching because 15,000 reads a second against one database is uncomfortable.

The mistake I see is people doing careful arithmetic and then never using it. Every number should change a decision: whether you need a cache, a queue, read replicas, partitioning, or a CDN. If it doesn't, you didn't need to calculate it."


Numbers worth memorising

Quantity Value
Seconds per day 86,400 โ‰ˆ 10^5
Seconds per month ~2.6 million
1 million requests/day ~12/s average
1 billion requests/day ~12,000/s average
1 KB ร— 1 billion 1 TB

Worked example: photo feed, 10M DAU

Item Arithmetic Result
Reads/day 10M ร— 50 500M
Read rps (avg) 500M รท 10^5 ~5,000/s
Read rps (peak, 3ร—) 5,000 ร— 3 ~15,000/s
Uploads/day 10M ร— 0.2 2M
Upload rps (peak) 2M รท 10^5 ร— 3 ~60/s
Metadata/year 2M ร— 1 KB ร— 365 ~730 GB
Photos/year 2M ร— 2 MB ร— 365 ~1.5 PB
Read egress (peak) 15,000 ร— 200 KB thumbnail ~3 GB/s โ†’ CDN

How the numbers change the design

Finding Design consequence
Reads โ‰ซ writes (250:1) Cache-aside with Redis; read replicas
1.5 PB/year of binaries Blob Storage with lifecycle tiers, not the database
3 GB/s egress Azure Front Door / CDN in front of Blob Storage
< 1 TB/year metadata One Azure SQL database is fine for years
60 writes/s No need for a write queue for throughput
Client -> Front Door (CDN) -> Blob Storage (photos)
   |
   +--> API (App Service / Container Apps, ASP.NET Core)
           |-> Redis (hot feed items)
           |-> Azure SQL (metadata, primary + readable secondary)

Production example

On an internal reporting service, an estimate of 300 report generations a day โ€” under one request a minute โ€” showed the team's planned Kubernetes cluster and Kafka were unnecessary. A single Container App with a Service Bus queue for the 2-minute report jobs ran at about A$150 a month instead of the A$3,000 estimate for the cluster.

๐Ÿ” What the interviewer is checking

Checks whether the candidate can turn scale assumptions into numbers quickly and use them to drive concrete design decisions.

Green flags

  • Separates reads and writes and applies a peak factor
  • Rounds sensibly and states assumptions
  • Estimates storage including binaries and overheads
  • Links each number to a design decision

Red flags

  • No peak factor, or sizing on averages
  • Arithmetic errors of several orders of magnitude
  • Numbers that never influence the design

๐Ÿ“š Learn in depth

1. Why estimates work even when they are wrong

Capacity estimates only need to be right within an order of magnitude. The decision boundaries in design are coarse: a single SQL database handles thousands of simple queries per second; a single Redis node tens of thousands or more; one App Service instance hundreds to low thousands of requests per second depending on the work. If your estimate is 200/s or 400/s, the design is the same. If it's 200/s or 200,000/s, it is not.

2. The pipeline of an estimate

DAU
  x actions/user/day (reads and writes separately)
  = requests/day
  / 86,400 (~10^5)
  = average rps
  x peak factor (2-10x)
  = peak rps  --> compute and DB sizing

writes/day
  x record size
  x 365
  x (1 + index overhead) x replicas
  = storage/year  --> data store choice, partitioning

peak rps x payload
  = bandwidth  --> CDN, egress cost

3. Peak factors

Traffic is never flat. Business apps peak in working hours (roughly 8 busy hours, so peak โ‰ˆ 3ร— the 24-hour average). Consumer apps have evening peaks. Event-driven systems (ticket sales, end-of-month payroll) can hit 10โ€“100ร— for minutes. Ask about events: a ticketing system's design is driven entirely by the on-sale spike.

4. Storage overheads

Raw record size understates storage. Add indexes (often 30โ€“100% extra in SQL Server), replicas (Azure SQL Business Critical keeps several replicas; Blob Storage ZRS keeps three copies), backups and retention. For logs and audit data, retention policy matters more than daily volume.

5. Cache sizing

If 20% of items get 80% of reads, cache the hot 20%. With 10 million posts at 1 KB, the hot set is 2 GB โ€” one small Redis instance. Estimate hit ratio and the database load that remains: at 95% hits, 15,000 reads/s becomes 750/s on the database.

6. Cost as an output

Once you have storage and egress, you can rough out monthly cost. Egress and premium storage often dominate; compute is frequently the smallest line.

Try it yourself

  1. Estimate peak rps and storage/year for a URL shortener with 100M new links a month and a 100:1 read ratio.
  2. Re-run the photo example with a peak factor of 10 and list what changes.
  3. Use a load test (Azure Load Testing or k6) against one instance of a sample ASP.NET Core API to measure its real requests/s, and compare with your assumption.
  4. Calculate the database load remaining at 80%, 95% and 99% cache hit rates for 15,000 reads/s.
  5. Estimate one year of Application Insights log volume for 1,000 requests/s with three log lines each at 500 bytes.

๐Ÿ’ป Code

A tiny estimator keeps the arithmetic honest and makes assumptions explicit โ€” handy for a design doc.

namespace Design.Capacity;

public sealed record Workload(
    long DailyActiveUsers,
    double ReadsPerUser,
    double WritesPerUser,
    int RecordBytes,
    int ResponseBytes,
    double PeakFactor = 3.0,
    double IndexOverhead = 0.5);

public sealed record Estimate(
    double AvgReadRps, double PeakReadRps,
    double AvgWriteRps, double PeakWriteRps,
    double StorageGbPerYear, double PeakEgressMbps);

public static class CapacityEstimator
{
    private const double SecondsPerDay = 86_400;

    public static Estimate Calculate(Workload w)
    {
        var readsPerDay = w.DailyActiveUsers * w.ReadsPerUser;
        var writesPerDay = w.DailyActiveUsers * w.WritesPerUser;

        var avgRead = readsPerDay / SecondsPerDay;
        var avgWrite = writesPerDay / SecondsPerDay;

        // Storage grows with writes; indexes add a percentage on top.
        var storageGb = writesPerDay * w.RecordBytes * 365 * (1 + w.IndexOverhead) / 1e9;

        // Egress in megabits per second at peak.
        var egressMbps = avgRead * w.PeakFactor * w.ResponseBytes * 8 / 1e6;

        return new(avgRead, avgRead * w.PeakFactor, avgWrite, avgWrite * w.PeakFactor, storageGb, egressMbps);
    }
}

// var e = CapacityEstimator.Calculate(new Workload(10_000_000, 50, 0.2, 1_024, 2_048));
// e.PeakReadRps โ‰ˆ 17,361; e.StorageGbPerYear โ‰ˆ 1,121

โš  Common mistakes

  • Mistake: Using only the average rate. Why it is wrong: Systems fail at peak, not on average. Instead: Apply a stated peak factor and size for the peak.
  • Mistake: Mixing reads and writes. Why it is wrong: They scale differently โ€” reads with caches and replicas, writes with partitioning and queues. Instead: Estimate them separately.
  • Mistake: Over-precise arithmetic. Why it is wrong: It wastes interview time and implies false accuracy. Instead: Round to powers of ten and one significant figure.
  • Mistake: Forgetting binaries and overheads. Why it is wrong: Files, indexes, replicas and retention often dwarf row data. Instead: Estimate blob storage separately and add index and replica overhead.
  • Mistake: Calculating numbers that never affect the design. Why it is wrong: The interviewer wants to see the estimate drive decisions. Instead: Say what each number implies: cache, CDN, replicas, partitioning.
  • Mistake: Ignoring growth. Why it is wrong: A design sized for launch day may need a rewrite in a year. Instead: Estimate year one and year three, and say what changes between them.

๐Ÿ› Senior insight: trade-offs

Seniors use estimates to rule things out as much as in. "60 writes per second โ€” we don't need sharding, and a queue would only add failure modes" is as valuable as proving you need a CDN. They also validate the estimate against reality as soon as possible: a load test on one instance replaces an assumed per-instance capacity with a measured one.

The second senior habit is turning capacity into cost. Egress, premium storage and log ingestion are often the expensive lines, and an estimate exposes them before they appear on the invoice.

Finding Typical response Cost When not to
Read rps in the thousands, 100:1 ratio Cache-aside, replicas Staleness, cache invalidation Data must be read-your-writes everywhere
Storage growing past a few TB/year Archive tiers, partitioning Query complexity Data is small and short-lived
Write rps in the thousands Partitioned store or queue-based levelling Ordering and consistency complexity Writes are a few per second
Egress in GB/s CDN CDN cost, cache invalidation Personalised, uncacheable responses

๐Ÿ”— Follow-ups the interviewer may ask

  1. When: Candidate talks about bandwidth or payload sizes Why: Checks the difference between latency, bandwidth and throughput
    How to answer
    • Latency: how long one thing takes, such as one round trip or one request (ms). Bounded by distance (light in fibre travels roughly 200 km per ms) plus queuing and processing.
    • Bandwidth: the maximum data rate of a link (Mbit/s, Gbit/s). The width of the pipe.
    • Throughput: what you actually achieve (requests/s or MB/s). Limited by bandwidth, latency, windows, concurrency and the slowest component.

    For most APIs, latency ร— number of round trips dominates, not bandwidth. A request that makes 50 sequential database calls at 2 ms RTT spends 100 ms on the network; move the database to another region at 30 ms RTT and it spends 1.5 s. Fix it by reducing round trips (batching, joins, fewer chatty calls), moving compute near data, caching, and parallelising independent calls.

  2. When: Candidate concludes the read path needs a cache Why: Checks how the candidate would design caching across many instances
    How to answer

    With 20 instances, a local cache is fastest but each instance holds its own version, while a distributed cache (Redis) gives one shared version at the cost of a network hop. I usually combine them: a short-lived L1 in each instance in front of a shared L2, which is exactly what HybridCache provides.

    To keep L1 copies in line, I publish invalidation messages (Redis pub/sub or an Azure Service Bus topic) that every instance uses to evict keys. Messages can be missed, so the L1 lifetime is the real staleness bound.

    I choose per data class: data that must agree everywhere skips L1, tolerant data gets longer L1. The trade-off is latency and Redis load versus how long instances may disagree.

  3. When: Candidate's storage estimate reaches terabytes Why: Checks how they would scale and partition a large SQL Server database
    How to answer

    I start with numbers: data size and growth, hot versus cold data, read/write ratio and tenant distribution. Then:

    • Partitioning (by date) is mainly a manageability tool: SWITCH makes archiving and purging metadata-only and enables partition-level index rebuilds. It is not an automatic speed-up and needs queries that allow partition elimination.
    • Archive cold data to cheaper storage or a history database.
    • Tenant layout: shared schema for many small tenants, database per tenant in an elastic pool for isolation, a hybrid for large tenants.
    • Hyperscale for one large database (up to 128 TB, fast scaling, read replicas); elastic pools for many small databases sharing compute.

    Shard only when scale-up, read scale-out and archiving are exhausted: it moves complexity into the application.

๐Ÿ›  Real-world problems: how you handle them

Estimate showed a planned cluster was ten times oversized
Situation
[Company] planned a new [document processing] service on AKS with Kafka, expecting 'high scale'. Expected volume was [X documents per day] for [Y internal users], hosted in Australia East.
Signals
The infrastructure estimate was [A$ amount] per month before any code was written; nobody could say what peak load the cluster was sized for.
Investigation
Ran a back-of-the-envelope estimate from the user count and actions per day: [N] requests per day, under [n] requests per second at a 3× peak. Load-tested a prototype ASP.NET Core API on a single Container App instance with Azure Load Testing to measure real throughput per instance.
Resolution
Replaced the cluster and Kafka with Azure Container Apps (scale 1–5 replicas), a Service Bus queue for long-running jobs and one Azure SQL database. Recorded the decision and the numbers in an ADR with the trigger points for revisiting.
Prevention
Added a capacity estimate section to the design document template, with year-one and year-three numbers. Set Azure Monitor alerts on replica count and queue length so growth past the assumptions is visible.

How to tell it (STAR)

**S:** At [company], a new [document processing] service was planned on AKS with Kafka, costing about [A$ amount] a month before any code existed. **T:** I was asked to review the design before we committed. **A:** I did a quick estimate from the real user numbers — about [n] requests per second at peak — then load-tested a prototype on a single Container App instance, which handled [m] times that. I proposed Container Apps, a Service Bus queue and one Azure SQL database, and wrote an ADR listing the load at which we'd revisit. **R:** We launched [weeks] earlier, and the monthly cost was about [A$ amount], roughly [percentage]% lower than planned, with p95 latency of [x] ms.

โ†ฉ Usually asked after

More in Core System Design

Last updated 23 Nov 2026.

๐ŸŒ Sangam's Webring

โช Previous ๐Ÿ  Main Next โฉ
๐Ÿ’ฌ Chat with me