---
title: "Capacity and cost · Agent Wranglers"
url: https://agentwranglers.se/playbook/operations/capacity-and-cost
updated: 2026-10-20
licence: "All rights reserved"
---

# Capacity and cost

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

> Know how much load the service can carry, keep headroom, and warn before disks, memory or budgets run out instead of after.

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers operations playbook: https://agentwranglers.se/playbook/operations/capacity-and-cost`.

## Required

- [Keep headroom](https://agentwranglers.se/playbook/operations/capacity-and-cost/headroom): Keep normal peak load below a set share of the tested limit, such as 60 percent. Then a spike or a lost server does not break the service.
- [Size the runtime's memory to the box](https://agentwranglers.se/playbook/operations/capacity-and-cost/runtime-memory-limits): Set the language runtime's memory limits below the container or service limit, so it collects garbage before the system kills it.
- [Warn before resources run out](https://agentwranglers.se/playbook/operations/capacity-and-cost/exhaustion-alerts): Alert on how soon a disk, memory pool or quota will be full, not only on how full it is.

## Recommended

- [Turn work away before overload](https://agentwranglers.se/playbook/operations/capacity-and-cost/load-shedding): Cap how many requests each instance handles at once. Answer the rest at once with 503 and a `Retry-After` header instead of queueing them.
- [Watch what the service costs](https://agentwranglers.se/playbook/operations/capacity-and-cost/cost-monitoring): Track the cost of each service every month, set budget alerts, and look into any jump.

- Previous: [Running the service](https://agentwranglers.se/playbook/operations/running-the-service)
- Next: [Disaster recovery](https://agentwranglers.se/playbook/operations/disaster-recovery)
- [All chapters](https://agentwranglers.se/playbook/operations)
