A–MN–ZAZ
Middle row: app servers, each running the same program; the bar on the front is how busy its CPU isBack row: the shared state (cache, databases, object storage)Envelopes are requests; coins are data moving to and from the storesVisitors in front, the load balancer beside them, a row of app servers in the middle, and the shared state at the back: a cache, the primary database with two read replicas, and object storage. Scaling up makes one server taller; scaling out adds ordinary servers that share the requests, round robin. Because the servers keep no state, any of them can answer any request. The data scales too: replicas take the reads, and a second shard takes half the writes. Autoscaling adds a fourth server when the CPU bars pass the target. The CPU percentages are an example load chosen to make the arithmetic easy to follow, not a measurement of a real site.

Up or out

  1. Every visitor's request lands on one app server, the machine running the site's program. As visitors grow, its processor (CPU) gets busier: here 90%. Near 100%, new requests start waiting in line, and pages slow down.

Stateless servers

Scaling the data

Limits and autoscaling

What happens

;; step 1/10 · one-server
visitors → app server 1
CPU busy   90%  (example load)
near 100% requests queue and pages slow down
the site needs more computing power

The CPU percentages are an example load chosen to make the arithmetic easy to follow, not a measurement of a real site. Some setups pin each visitor to one server (sticky sessions) instead of sharing the session. The Twelve-Factor App calls that a violation of stateless design: when that server goes away, so does the session.