/sre-skills:capacity-planning-and-load-testingfrom sre-skills
Guides demand forecasting and load/stress/soak testing to find real bottlenecks and set evidence-based autoscaling triggers. Use for capacity planning before launches or when production fails under load.
Ships in sre-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A system that "should" handle expected peak traffic is a hypothesis, not a fact, until it's been tested against realistic load — and the whole point of load testing is to find the actual bottleneck (which is very often not where anyone assumed) before real users do. A load test that only exercises the application tier while the database connection pool, a downstream dependency's rate limit, or a fixed-size thread pool is the real ceiling produces false confidence: the app tier looks fine at 2x scale while the system as a whole falls over well before that. This skill covers forecasting demand, choosing the right test type (load, stress, soak) for the question being asked, instrumenting the whole request path during a test (not just app-tier CPU/memory) so the real bottleneck is found instead of assumed, and turning test results into concrete, evidence-based autoscaling and capacity triggers.
Forecast demand. Pull historical peak RPS and month-over-month or year-over-year growth rate; fold in known upcoming events (a marketing push, a seasonal peak). Set a target test peak with a safety margin above the forecast — commonly 1.5-2x the expected real peak — rather than testing to exactly the forecast number.
Choose the right test type(s) — they answer different questions:
Write the test script. k6 example combining a load stage and a stress ramp:
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
scenarios: {
load_test: {
executor: 'ramping-vus',
startVUs: 0,
stages: [
{ duration: '2m', target: 200 }, // ramp to expected peak
{ duration: '10m', target: 200 }, // hold at peak
{ duration: '2m', target: 0 },
],
},
},
thresholds: {
http_req_failed: ['rate<0.01'], // fail test if error rate > 1%
http_req_duration: ['p(99)<300'], // fail test if p99 > 300ms
},
};
export default function () {
const res = http.post('https://staging.example.internal/api/checkout', JSON.stringify({
cart_id: `cart-${__VU}-${__ITER}`,
}), { headers: { 'Content-Type': 'application/json' } });
check(res, { 'status is 200': (r) => r.status === 200 });
sleep(1);
}
For a stress test, replace the stages with a ramp that keeps
increasing ({ duration: '5m', target: 400 }, 600, 800, ...)
until thresholds start failing, to find the ceiling. Locust expresses
the same idea as a HttpUser class with @task methods and a
--users/--spawn-rate ramp; JMeter expresses it as a Thread Group
with a ramp-up period.
Instrument the whole path during the run, not just the app tier. Watch, at minimum: app CPU/memory, database connection pool utilization (active vs. max connections), database CPU/IOPS, cache hit rate, message queue depth, and downstream/third-party dependency latency and error rate. A test that only graphs app-tier CPU will report "the app was only at 45% CPU" while the real ceiling — a fixed-size DB connection pool — was maxed out the whole time.
Find the actual bottleneck systematically. When the test's thresholds start failing (error rate/latency breach), check saturation signals in order rather than assuming it's the app tier: app CPU/ memory → database connections/CPU → connection pool max setting → downstream dependency rate limits/latency. The bottleneck is whichever resource hits its ceiling first as load increases — it is very often a fixed pool size or a downstream rate limit, not raw app compute.
Derive scaling triggers from the evidence, not from defaults:
if p99 latency breaches SLO once app CPU crosses 70%, set the HPA
target below that (e.g. 60%) to leave headroom for scale-up lag; if
the test shows the DB connection pool saturating at 300 concurrent
app replicas, either cap maxReplicas at a safe value, increase the
pool/add a read replica, or scale on a custom metric (e.g.
requests-in-flight) that reflects the real constraint instead of CPU.
Respect safety boundaries around where the test runs.
Warning: Never run an uncapped stress or soak test against production without an explicit plan — it can itself cause the exact outage it was meant to prevent. If a test must touch production or shared infrastructure: get stakeholder sign-off, schedule off-peak, cap the request rate below the threshold that would cause customer-visible impact, and have an abort/kill-switch and rollback path ready before starting (the traffic-shifting/rollback mechanics from blue-green-canary-deployments are a reasonable abort mechanism). Prefer an isolated, production-topology-mirroring environment whenever the question can be answered there.
Re-run periodically. Capacity assumptions decay as code and traffic patterns change — re-run before major events and on a fixed cadence (e.g. quarterly), and feed results into the pre-production gates in environment-promotion-strategy and the canary-analysis thresholds in blue-green-canary-deployments.
Symptom: The load test passes cleanly at 2x expected peak with app CPU never exceeding 50%, but production falls over well below that traffic level with 5xx errors. Fix: The test likely stubbed or mocked the database/downstream dependencies, so it never touched the real connection pool or rate-limited API. Run tests against a production-like DB topology and pool configuration, and monitor pool utilization as a first-class saturation signal, not just app CPU/memory.
Symptom: The test traffic profile is pure read-heavy GETs, but the real workload (checkout, payment) is write-heavy with transactional locking — the test result has no relationship to real behavior. Fix: Build test scenarios from actual production traffic mix/user-journey data (APM or access logs), not a generic synthetic guess at "typical" traffic.
Symptom: A stress test run directly against production, with no rate cap and no abort plan, itself causes a customer-facing outage. Fix: This is exactly the destructive-action risk called out in step 7 — run in an isolated environment first; if production testing is truly necessary, cap the rate below customer-impact thresholds, schedule off-peak with stakeholder sign-off, and have a kill switch/ rollback ready before starting, never as an afterthought.
Symptom: A short load test passes every time, but a slow memory leak or a filled disk from verbose logging only surfaces in production after several hours of real traffic. Fix: No soak test was run. Add a multi-hour (6-24h+) soak test at moderate sustained load alongside the shorter peak-load test — this is the only test type designed to catch time-dependent degradation.
Symptom: Autoscaling is configured with the default 70% CPU target "because that's what the docs suggested," with no test evidence behind it, and the service still degrades under real peak load. Fix: Derive the scaling trigger directly from where the test showed the SLI actually breaching (step 6), with margin for scale-up lag — not from a generic default.
Scenario: checkout-service capacity validation ahead of a major
seasonal sales event.
requests_in_flight) that actually
correlates with the real bottleneck; the DB connection pool increased
from 200 to 350 and a read replica added for reporting queries to
free up pool headroom on the primary; maxReplicas on the app
deployment capped at the value that keeps pool demand under the new
350-connection ceiling.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 skills in this plugin
/blameless-postmortem-and-root-cause-analysisGuides running a blameless postmortem after an incident — using a consistent template (timeline, impact, root cause, contributing factors, action items), facilitating without assigning individual blame, applying 5-whys/contributing-factor analysis without oversimplifying to one root cause, and tracking action items through to completion. Use when a user asks to "write a postmortem", "run a root-cause analysis", "do a 5-whys on this incident", "make sure this incident doesn't get blamed on one person", or "our postmortem action items never actually get done."
/chaos-engineering-and-resilience-testingGuides running chaos engineering experiments — defining a measurable steady-state hypothesis, controlling blast radius, and using fault-injection tools (Chaos Mesh, LitmusChaos, AWS Fault Injection Simulator) to proactively validate a system's resilience assumptions — plus running structured "game days" and graduating experiments from staging to controlled production runs. Use when a user asks to "run a chaos engineering experiment", "test what happens if we kill a pod/ lose an AZ", "run a game day", "validate our failover actually works", or "find resilience gaps before a real incident does."
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin sre-skillsOther plugins' skills for the same job