Course contents

01. System Design Fundamentals Lesson 5 of 8

Throughput

Estimate a server’s capacity, watch throughput plateau past it, raise it with concurrency, and find the bottleneck stage that caps a whole system.

12 minBeginner7 steps
Loading the interactive simulation…
Loading the knowledge check…

Summary

  • Throughput is completed work per second; offered load is what arrives.
  • Capacity ≈ concurrency ÷ time per request.
  • Past capacity, throughput plateaus while latency and errors rise.
  • A pipeline is as fast as its slowest stage; capacity added elsewhere is wasted.
  • Little’s law ties them together: in progress = throughput × latency.
Deep diveHow it works, trade-offs, failure modes, misconceptions and the interview angle.

What it is

Throughput is the amount of work a system completes per unit of time: requests per second for an API, queries per second for a database, messages per second for a queue consumer, bytes per second for a network link. It counts only completed work. The rate at which work arrives is the offered load; throughput can match it, but never exceed it.

Why it exists

Every component has a finite capacity, and the offered load changes: daily peaks, marketing campaigns, a viral post. Knowing throughput and capacity tells you how much traffic a system can absorb, where it will break first, and how many machines you need. It is the basis of capacity planning and of most scaling decisions.

How it works

Capacity of one component. A component that can work on c requests at once, each taking t seconds, completes at most c ÷ t per second. Four workers at 50 ms each give about 80 requests per second. The concurrency limit can be threads, processes, connections in a pool, CPU cores, or disk I/O slots, whichever runs out first.

Below capacity, throughput equals offered load. At capacity, the component is 100% busy and throughput plateaus. Extra requests wait in a queue, adding latency, and once the queue is full they are rejected or time out. Overloaded systems can even complete less than their capacity, because they spend effort on requests that time out before finishing (wasted work) or on retries.

Pipelines. When every request passes several stages in sequence, the stage with the lowest capacity, the bottleneck, caps the whole system. Upstream stages often look saturated too, because their workers are blocked waiting for the bottleneck; that is why "everything is at 100%" is common during an incident and why you look for the component whose own work, not waiting, fills it.

Little's law. For a stable system, the average number of requests in progress equals throughput multiplied by the average time each spends inside: L = λ × W. It sizes worker pools, connection pools and queues: 500 requests per second at 80 ms each means about 40 requests in flight.

When to use it

Throughput is the headline metric for batch jobs, data pipelines, queue consumers and any capacity planning. For online services it sits beside latency and error rate: you track requests per second to know how close each component is to its limit and to plan scaling before peaks.

When not to

Throughput alone says nothing about user experience. A system at 100% utilisation shows excellent throughput and terrible latency. For interactive services, set targets on latency percentiles and error rate, and treat throughput as a capacity measure rather than a goal.

Trade-offs

Technique Raises throughput because Cost
More concurrency (threads, workers, connections) More requests run at once Memory, contention; useless for CPU-bound work beyond the core count
Cheaper requests (optimised code, indexes) Each request holds resources for less time Engineering time
More machines Multiplies capacity Needs a balancer, stateless design; shared dependencies remain
Batching Amortises fixed per-request overhead Higher latency per item
Asynchronous processing Accepts work quickly, processes at the sustainable rate Results arrive later; more moving parts
Running near 100% utilisation Fewer machines Long queues, high latency, no burst headroom

Alternatives

When a stage cannot keep up and cannot easily be scaled, you can change the shape of the load instead: cache results so fewer requests reach it, queue work and process it at a steady rate, shed low-priority traffic, or rate-limit clients so the system stays within its capacity.

Failure modes

  • Scaling the wrong stage. Adding app servers when the database is the bottleneck increases load on the database.
  • Unbounded queues. Accepting work faster than it can be processed hides overload until memory runs out or latency becomes unacceptable.
  • Retry amplification. Clients retry rejected requests, raising offered load exactly when capacity is short.
  • Connection pool exhaustion. Threads block waiting for a pool connection; the application looks saturated though it does little work.
  • Throughput collapse. Past a point, contention (locks, cache thrashing, timeouts with wasted work) makes throughput fall as load rises.

In production

Load-test to find each component's real capacity rather than trusting estimates, and repeat after significant changes. Monitor saturation signals (utilisation, queue depth, pool wait time) alongside requests per second. Size pools with Little's law plus headroom. Keep utilisation of latency-sensitive services well below 100% and plan for peak, not average, traffic. Bound every queue and reject early with a clear error rather than collapsing.

Common misconceptions

  • "Throughput and latency are inverses." Not simply. More concurrency can raise throughput without changing per-request latency, until queueing begins.
  • "More threads always mean more throughput." Only while the threads have idle resources to use; for CPU-bound work, beyond the core count they add contention.
  • "Capacities add up across a pipeline." In series, the minimum wins.
  • "100% utilisation is efficient." It means a queue is forming and latency is growing.

Interview angle

Do the arithmetic out loud: daily active users to peak requests per second, requests per second per instance from concurrency and latency, then the number of instances with headroom. Identify the likely bottleneck (often the database or a third-party API) and say how you would relieve it: caching, read replicas, batching or asynchronous processing. Using Little's law to size a connection pool is a small detail that stands out.

Model assumptions

The simulation is a simplified model, not a benchmark. The app server has 4 (later 16) workers, a 50 ms mean service time (lognormal, cv 0.3) and room for 10 waiting requests; beyond that it rejects. A worker waiting for the database stays busy. The database has 4 (later 8) connections and a 40 ms mean query time. Workers never compete for CPU, so adding workers always adds capacity here; real servers stop gaining once CPU, memory or locks run out. Arrivals are random (Poisson). Numbers show behaviour and orders of magnitude only.

The lesson as textEvery step of the simulation, written out.
  1. 1. Throughput is work finished per second

    Throughput is how many requests a system completes successfully per second. Offered load is how many arrive. Right now users send about 40 requests per second and the server finishes about 40: everything that comes in goes out.

    Latency asks “how long does one request take?”. Throughput asks “how many can we finish per second?”. They are related, but they are different questions.

    Scene: Users send about 40 requests per second to one app server, which completes all of them and is about half busy.

    Key idea: Throughput counts completed work per unit of time; it can never exceed the offered load.

  2. 2. How much can one server do?

    The server has 4 workers and each request takes about 50 ms. One worker can finish 20 requests per second, so four can finish about 80 per second. That is its capacity: concurrency divided by time per request.

    Traffic rises to 70 requests per second. The server keeps up, finishing about 70, but it is now close to fully busy.

    Scene: At 70 requests per second the server completes about 70 per second and is close to fully busy.

    Key idea: Capacity ≈ concurrent workers ÷ time per request. 4 workers × (1 s ÷ 50 ms) = 80 req/s.

  3. 3. Past capacity, throughput stops growing

    Traffic climbs to 120 requests per second. Throughput does not follow: it flattens at about 80, the server’s capacity. The other 40 per second wait until the queue is full and are then rejected.

    Latency rises too, because every accepted request now waits behind others. Past capacity you get the worst of both: no more work done, slower answers and errors.

    Scene: At 120 requests per second the server still completes only about 80 per second. Its queue is full, about a third of requests are rejected and latency is higher.

    Key idea: Above capacity, throughput plateaus; extra load turns into queueing delay and errors, not more work.

  4. 4. More workers, more throughput

    We give the server 16 workers instead of 4. Each request still takes 50 ms, but four times as many run at once, so capacity rises to about 320 per second.

    Throughput now matches the offered 120 and the errors stop. In a real server this only works while the extra workers have something to run on: if the work is CPU-bound, adding threads beyond the CPU cores does not help.

    Scene: With 16 workers the server completes all 120 requests per second, nothing is rejected, and it is less than half busy.

    Key idea: Raise throughput by doing more at once (concurrency) or by making each request faster.

  5. 5. The slowest stage sets the pace

    Every request now also reads from a database with 4 connections and about 40 ms per query: at most about 100 queries per second. The app server could do more, but it cannot finish a request before the database answers.

    Throughput drops to about 100, the database’s limit. App workers sit waiting for it, the app’s queue fills, and the excess is rejected. A system is only as fast as its slowest stage.

    Scene: The app server now queries a database for every request. The database is fully busy and throughput falls to about 100 per second; the rest is rejected.

    Key idea: End-to-end throughput is capped by the bottleneck: the stage with the least capacity.

  6. 6. Widen the narrowest stage

    Doubling the app’s workers again would change nothing: the database is the limit. Instead the database gets 8 connections (a bigger instance), so it can run about 200 queries per second.

    Throughput is back to the full 120 and errors stop. The bottleneck has moved: whichever stage is now closest to its capacity will limit the next round of growth.

    Scene: With 8 database connections both the app server and the database have headroom. All 120 requests per second complete.

    Key idea: Spend capacity on the bottleneck; anywhere else it is wasted.

  7. 7. Throughput, latency and concurrency

    The three are tied together by Little’s law: requests in progress = throughput × latency. Each request holds an app worker for about 95 ms (its own work plus the database round trip). At 120 requests per second that means about 120 × 0.095 ≈ 12 requests in progress at any moment, so the app needs at least 12 workers.

    To raise throughput: add concurrency where the bottleneck is, make each request cheaper, or spread work over more machines. Watch latency while you do, because high throughput at 100% utilisation comes with long queues.

    Scene: The final setup: 120 requests per second through an app server with 16 workers and a database with 8 connections; everything completes.

    Key idea: In progress = throughput × latency: use it to size workers, pools and queues.