Agent Wranglers

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 6
  • Recommended 26
  • Avoid 1

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, the share of background work each customer gets, and growing the database. Queues, jobs and events themselves live in the integration and events playbook. It ends with load balancing and autoscaling. Fair shares per customer sit with the queues, and cost per request lives in the infrastructure playbook. Most apps never need half of it, so measure first and scale the part that is slow.

Chapters

  1. 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
  2. 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 2
    • Recommended 3
  3. Caching

    Cache only what is read often and costly to build. Key it fully, let one caller rebuild an entry, spread hot keys and keep working without a cache.

    • Required 2
    • Recommended 6
  4. Exports and fair share

    Build large exports ahead of time and cap each customer's share of background work. Queues and jobs themselves live in the integration and events playbook.

    • Recommended 2
  5. 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
  6. Load balancing and autoscaling

    Send traffic only to ready servers and spread it by load. Scale on the resource that runs out, cap serverless copies and keep model calls within limits.

    • Recommended 6

All 33 rules on one page

This is a lot to check. An Expert can check it for you.

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.