Performance vs scalability
Performance and scalability are related but different questions. Performance asks how quickly the system handles one unit of work. Scalability asks what happens to that speed, and to the bill, as the amount of work grows. Most design discussions are really about the second question, so it helps to keep the two apart from the first minute.
Two kinds of slow
Section titled “Two kinds of slow”A quick diagnostic separates the two problems:
| Symptom | Likely problem | Typical fixes |
|---|---|---|
| A single request on an idle system takes 2 s | Performance | Profile, fix the N+1 query, add an index, use a better algorithm |
| p99 latency is fine at 100 RPS and terrible at 5,000 RPS | Scalability | Add capacity, remove the shared bottleneck, cache, partition |
| Throughput stops growing when you add servers | Scalability (contention) | Find the shared resource: a lock, a primary database, a hot key |
| Throughput drops when you add servers | Scalability (coherency cost) | Reduce cross-node chatter, partition the data, avoid global locks |
A system scales well when adding resources raises capacity in proportion. The capacity can mean more requests per second, bigger datasets or more tenants. Adding redundancy should not make it slower either. Performance work and scalability work feed each other. A request that takes half the CPU time also halves the number of servers you need.
Scaling up vs scaling out
Section titled “Scaling up vs scaling out”Vertical scaling (scale up) means a bigger machine: more cores, RAM, faster disks. Horizontal scaling (scale out) means more machines behind a load balancer.
| Scale up | Scale out | |
|---|---|---|
| Code changes | None | Service must be stateless, or the data must be partitioned |
| Ceiling | The largest machine you can buy or rent | Very high, limited by coordination and shared dependencies |
| Failure | One box is a single point of failure | Losing one node removes 1/N of capacity |
| Cost curve | Rises steeply at the top end | Roughly linear, plus the cost of the coordination layer |
| Operations | Simple | Deployment, discovery, monitoring of many nodes |
In 2026 the vertical ceiling is far higher than when the original primer was written. Cloud providers rent single machines with hundreds of cores and multiple terabytes of RAM; the largest AWS high-memory instance (u7inh-32tb.480xlarge) has 1,920 vCPUs and 32 TiB. A single well-tuned PostgreSQL primary with read replicas carries many products further than people expect. So a reasonable default is to scale up until it becomes expensive or risky, and to design for scale-out where you know you will need it. The load balancers page covers the mechanics of scale-out.
Stateless services: the precondition for cloning
Section titled “Stateless services: the precondition for cloning”A service is stateless when any instance can serve any request, because nothing a request needs lives only in one instance’s memory or local disk. State still exists — it just lives in a shared place:
- Sessions and short-lived user state go to a shared cache (Redis or Valkey) or into a signed token the client carries.
- Uploaded files go to object storage, not the local disk.
- Durable data stays in the database; work in progress goes to a queue.
flowchart LR
client["Clients"] --> lb["Load balancer"]
lb --> app1["App server 1<br/>(stateless)"]
lb --> app2["App server 2<br/>(stateless)"]
lb --> app3["App server N<br/>(stateless)"]
app1 & app2 & app3 --> sess[("Session store<br/>Redis / Valkey")]
app1 & app2 & app3 --> db[("Database")]
app1 & app2 & app3 --> obj[("Object storage")]
Once the app tier is stateless you can add or remove instances freely, use autoscaling, and deploy by replacing instances built from the same image. The hard part of scaling moves to the stateful tier, which is why most of this site is about data.
Why adding machines stops helping
Section titled “Why adding machines stops helping”Amdahl’s law
Section titled “Amdahl’s law”If a fraction p of the work can run in parallel and the rest is serial, the best speed-up on N workers is 1 / ((1 − p) + p / N). The serial part sets a hard limit of 1 / (1 − p), no matter how many machines you add.
| Parallel fraction | 8 workers | 32 workers | 128 workers | Limit |
|---|---|---|---|---|
| 95% | 5.9× | 12.5× | 17.4× | 20× |
| 99% | 7.5× | 24.4× | 56.4× | 100× |
In a web system the “serial part” is anything every request must pass through one at a time: a single primary database, a global lock, a sequence generator, a hot row.
The Universal Scalability Law
Section titled “The Universal Scalability Law”Neil Gunther’s Universal Scalability Law (USL) adds a second penalty. Besides contention (waiting for a shared resource, the Amdahl term), nodes pay a coherency cost to keep each other’s data in sync. Coherency cost grows with the number of node pairs, roughly N². Relative capacity is:
C(N) = N / (1 + α(N − 1) + βN(N − 1))α = contention (queueing for shared resources)β = coherency (cross-node coordination)With α = 0.05 and β = 0.001, capacity is 5.7× at 8 nodes and peaks at about 9× around 31 nodes. Past that point it falls: 7.8× at 64 nodes and 5.4× at 128. Adding servers then makes the system slower. The practical lessons:
- Measure throughput at several cluster sizes and fit the curve before buying hardware.
- Reduce α by removing shared bottlenecks: partition data, avoid global locks.
- Reduce β by avoiding all-to-all communication: gossip, chatty cache invalidation and cluster-wide transactions all add to it.
The four classic moves
Section titled “The four classic moves”The Scalability for Dummies series (see Further reading) describes a path most web products follow. Here it is in short, with links to the detailed pages:
- Clones. Make the app tier stateless and run identical instances behind a load balancer. Build every instance from the same image so they never drift. See load balancers and monolith and microservices.
- Database. The single database becomes the bottleneck next. Options are read replicas, partitioning and sharding, denormalising the hot paths (denormalisation and tuning), or a store built to scale out (SQL or NoSQL). In practice, add read replicas and a cache before you shard. See also replication.
- Cache. Keep hot, expensive-to-compute objects in memory so most reads never reach the database. Cache whole objects rather than raw query results, so invalidation stays simple. See caching layers and cache strategies.
- Asynchronism. Do slow work ahead of time (pre-render, pre-compute) or after the response (queue it and notify later). This keeps request latency flat while total work grows. See queues and back pressure and event streaming.
The order still holds in 2026. Managed services now handle much of each step: managed load balancers, managed databases with replicas, managed caches and queues.
Cost is a scalability dimension
Section titled “Cost is a scalability dimension”A system that handles ten times the load at forty times the cost does not scale in any useful sense. Track cost per unit of work: per request, per active user, per GB stored. Watch how it changes with load.
- Sub-linear is the goal. Caches, batching and economies of scale should make the thousandth customer cheaper than the first.
- Idle capacity is a cost. Autoscaling, serverless functions and scale-to-zero databases trade some cold-start latency for paying only for use. Redundancy you keep for availability is a deliberate cost; size it on purpose.
- Distributed is not automatically efficient. McSherry, Isard and Murray found that many published big-data systems needed hundreds of cores to match one well-written single-threaded program, and some never matched it at all. Their COST metric is the hardware needed before a platform beats that single thread. A simpler design on one big machine is often both faster and cheaper.
- People cost too. Every extra moving part needs on-call, upgrades and expertise. Count that before splitting a service or adding a datastore.
Trade-offs
Section titled “Trade-offs”| Choice | You gain | You pay |
|---|---|---|
| Scale up | No code change, strong consistency for free, simple operations | Hard ceiling, steep price at the top, single point of failure |
| Scale out (stateless tier) | Near-linear capacity, rolling deploys, redundancy | Shared state must move out of the process; more infrastructure |
| Scale out (data tier) | Capacity beyond one machine | Cross-partition queries, rebalancing, weaker guarantees or costly coordination |
| Cache | Large read capacity cheaply | Stale data, invalidation bugs, cold-start stampedes |
| Asynchronous processing | Flat request latency, smoothing of spikes | Eventual results, retries, idempotency, harder debugging |
Further reading
Section titled “Further reading”- CS75 Lecture 9: Scalability (Harvard, David Malan) — a classic one-hour lecture: vertical and horizontal scaling, caching, load balancing, replication, partitioning.
- Scalability for Dummies (Le Cloud blog): Part 1 — Clones, Part 2 — Database, Part 3 — Cache, Part 4 — Asynchronism (archived copy).
- A Word on Scalability — Werner Vogels’ short definition of what “scalable” should mean.
- How to Quantify Scalability — Neil Gunther on the Universal Scalability Law: the formula, what each coefficient means and how to fit them to measurements (the full derivation is in his 2008 paper).
- Scalability! But at what COST? — McSherry, Isard and Murray (HotOS 2015) on measuring scalability against a single-threaded baseline.
Related topics
Section titled “Related topics”- Latency vs throughput — how to measure “fast” and why queues make load hurt.
- Load balancers — the mechanics of horizontal scaling.
- Partitioning and sharding — scaling the stateful tier.
- Caching layers — the cheapest capacity for read-heavy systems.
- Scaling to millions of users — the classic moves applied step by step.
Based on The System Design Primer by Donne Martin (CC BY 4.0). Restructured, rewritten and updated; site content is licensed under CC BY 4.0.