Scaling playbook
Rules for apps that must handle more users. Stateless servers, caches, background jobs, database growth, load balancing and capacity, each with a check.
- Required 7
- Recommended 29
- Avoid 2
A scaling playbook for apps that start to get busy. It starts with measuring, to find the bottleneck and write down the load you plan for. Then it covers stateless app servers, caching, background jobs and queues, and growing the database. It ends with load balancing, autoscaling, fair shares per customer and cost per request. Most apps never need half of it, so measure first and scale the part that is slow.
Chapters
Measure before you scale
Find the resource that runs out first from metrics and profiles. Write down the load you plan for before you add servers or caches.
- Recommended 5
Stateless app servers
Any copy of the app can serve any request, start fast and stop without losing work. Then you can add or remove copies at any time.
- Required 1
- Recommended 4
- Avoid 1
Caching
Cache only what is read often and costly to build. Key it fully, let one caller rebuild an entry, and keep the app up when the cache is gone.
- Required 2
- Recommended 4
Background jobs and queues
Move slow work out of requests into queues. Make every job safe to run twice, bound the backlog, and keep urgent work ahead of bulk work.
- Required 2
- Recommended 7
Growing the database
Budget connections across every copy, keep reports off the primary, partition and archive big tables, and change large tables in small batches.
- Required 2
- Recommended 4
- Avoid 1
Load balancing and autoscaling
Send traffic only to ready servers and spread it by load. Scale on the resource that runs out, cap each customer's share and watch cost per request.
- Recommended 5
This is a lot to check. An Expert can check it for you.
Related playbooks
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/scaling">Agent Wranglers scaling playbook</a>. In code you write, add a comment next to it with the same link.