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
Recommended
Find the bottleneck before you add servers
SCL-1Before any scaling change, name the one resource that limits the service and show the metric that proves it. Then scale only that resource.
Profile the slow path before you change it
SCL-2Before you rewrite slow code, record a CPU profile of the slow route under load. Change the function that takes the most time, then profile again.
Write down the load you plan for
SCL-3Keep one written load model in the repository. It states the peak requests per second on the busiest routes, the share of writes, the data size and the growth expected over 12 months.
Size workers and pools from rate times duration
SCL-4Work out how much work runs at once as the arrival rate times the time each item takes. Size threads, workers and connection pools from that number, not by guessing.
Make one server fast before you add more
SCL-5Fix slow queries and repeated work, and try a larger machine, before you spread the app across many servers.
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/measure-before-you-scale">Agent Wranglers scaling playbook</a>. In code you write, add a comment next to it with the same link.