Skip to content

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.

A quick diagnostic separates the two problems:

SymptomLikely problemTypical fixes
A single request on an idle system takes 2 sPerformanceProfile, fix the N+1 query, add an index, use a better algorithm
p99 latency is fine at 100 RPS and terrible at 5,000 RPSScalabilityAdd capacity, remove the shared bottleneck, cache, partition
Throughput stops growing when you add serversScalability (contention)Find the shared resource: a lock, a primary database, a hot key
Throughput drops when you add serversScalability (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.

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 upScale out
Code changesNoneService must be stateless, or the data must be partitioned
CeilingThe largest machine you can buy or rentVery high, limited by coordination and shared dependencies
FailureOne box is a single point of failureLosing one node removes 1/N of capacity
Cost curveRises steeply at the top endRoughly linear, plus the cost of the coordination layer
OperationsSimpleDeployment, 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.

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 fraction8 workers32 workers128 workersLimit
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.

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 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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.

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.
ChoiceYou gainYou pay
Scale upNo code change, strong consistency for free, simple operationsHard ceiling, steep price at the top, single point of failure
Scale out (stateless tier)Near-linear capacity, rolling deploys, redundancyShared state must move out of the process; more infrastructure
Scale out (data tier)Capacity beyond one machineCross-partition queries, rebalancing, weaker guarantees or costly coordination
CacheLarge read capacity cheaplyStale data, invalidation bugs, cold-start stampedes
Asynchronous processingFlat request latency, smoothing of spikesEventual results, retries, idempotency, harder debugging

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.