Scaling Patterns
Statelessness, load balancing, autoscaling signals, pagination, batching and streaming — the specific techniques, and the problem each one is a response to.
The inventory, the migration order and the verification — turning a service that works on one instance into one where any instance can serve any request.
A bigger machine is simpler and has a ceiling; more machines have no ceiling and require statelessness, a load balancer and coordination you did not have before.
What your application owes the thing distributing traffic to it — an honest health signal, aligned timeouts, and no assumption about which instance gets what.
Pinning a client to one instance buys cache locality and hides instance-local state — and it costs you failover, rebalancing and clean scale-down.
Choosing a signal that actually reflects load — and understanding why CPU is the wrong one for a service that spends its time waiting.
Routing reads to a replica multiplies read capacity and introduces a window where the application can read data that is older than what it just wrote.
Offset pagination is easy and gets quadratically more expensive with depth; keyset pagination is cheap at any depth and gives up random access to page N.