Design a Comprehensive Load Test Strategy with AI
Returns a load test strategy covering 5 scenario types (baseline / load / stress / spike / soak) with thresholds for response time, throughput, and error rate, environment requirements, monitoring checkpoints, and pass/fail criteria, and explicit environment-parity statement.
When to use it
- Designing performance testing for a new service or major release.
- Standardizing performance testing across multiple services in your org.
- Justifying performance investment to leadership with a defensible plan.
- Auditing existing perf tests to see if you're actually testing what you think.
The prompt
<role>You are a performance engineer. You know the difference between load, stress, spike, and soak, and you require ENVIRONMENT PARITY because a load test against a 1-CPU staging proves nothing about a 16-CPU production.</role> <context>Five canonical scenario types:- **Baseline**: Single-user, single-request: establish a non-loaded performance floor.- **Load**: Expected production traffic sustained for 15-30 min: verify the system handles normal day.- **Stress**: Gradually increasing load until breaking point: find the limit.- **Spike**: Sudden traffic surge (e.g., 5x in 30 seconds): test elasticity.- **Soak**: Steady load for hours: detect memory leaks, connection pool exhaustion. Each scenario has different success criteria. Thresholds are per-scenario, not global.</context> <task>For the system below, produce a load test strategy with:1. **All 5 scenario types**: each with: traffic profile, duration, success criteria (response time p95/p99, throughput, error rate)2. **Environment requirements**: explicit parity statement comparing test env to prod3. **Test data volume**: fixtures, seeded data, third-party stubs4. **Monitoring**: what's captured during runs, alert thresholds5. **Success criteria**: overall pass/fail definition for each scenario</task> <input>System description: {system}Expected production traffic: {traffic}Acceptable response time / error rate: {sla}Known constraints (environment limits, partner rate limits): {constraints}</input> <constraints>- All 5 scenarios MUST appear; do not conflate or omit.- Each scenario has p95 AND p99 thresholds (or justify omitting p99).- Environment parity statement is mandatory: name the differences explicitly.- Soak duration is hours (not minutes); spike is seconds-to-minutes.- Each scenario's success criterion must include error rate, not just response time.- Stress must ramp past the highest expected peak (including seasonal spikes), and the pass criterion compares the breaking point with that peak.- Size test data for the largest run (RPS × duration): one-shot data such as carts or orders runs out fast in a soak.</constraints> <output_format>Six sections:1. **Scenario table**: Scenario | Traffic profile | Duration | p95 | p99 | Throughput | Error rate2. **Environment parity**: paragraph explicitly comparing test env to prod3. **Test data volume**: bullets4. **Monitoring**: what's captured + alert thresholds5. **Run cadence**: when each scenario runs (per-PR, nightly, pre-release)6. **Overall pass/fail**: paragraph defining what "performance is healthy" means</output_format> <approach>Before writing, identify any scenario type that doesn't apply (rare but possible) and explain why instead of including it pro forma.</approach>## RolePerformance engineer. Load ≠ stress ≠ spike ≠ soak. REQUIRE environment parity. ## Context5 scenarios:- Baseline (single-user floor)- Load (expected traffic, 15-30 min)- Stress (ramp to breaking)- Spike (sudden 5x surge)- Soak (hours of steady load: memory leaks, connection pool) Thresholds per-scenario, not global. ## TaskFor the system:1. All 5 scenarios with traffic profile, duration, p95/p99, throughput, error rate.2. Environment parity statement.3. Test data volume.4. Monitoring + alerts.5. Overall pass/fail per scenario. ## Input- System: {system}- Expected traffic: {traffic}- SLA (response time, error rate): {sla}- Constraints: {constraints} ## Constraints- All 5 scenarios present.- p95 AND p99 per scenario (or justify omitting p99).- Environment parity statement mandatory.- Soak = hours; spike = seconds-to-minutes.- Success criterion includes error rate, not just RT.- Stress ramps past the highest expected peak (incl. seasonal spikes).- Size test data for the largest run (RPS × duration). ## Output format6 sections: Scenario table | Environment parity paragraph | Data volume bullets | Monitoring + alerts | Run cadence | Overall pass/fail paragraph. ## ApproachSkip a scenario only if explicitly justified (rare).Example
Input
System description: E-commerce checkout API. POST /api/checkout creates an order, charges via Stripe, sends confirmation email. ~30 lines of code, calls 3 internal services (inventory, payment, email) and 1 external (Stripe). Expected production traffic: 100 RPS sustained peak; 500 RPS during Black Friday spike. Acceptable response time / error rate: p95 < 800ms, p99 < 2s, error rate < 0.5%. Known constraints: Stripe sandbox rate limit 25 RPS, load tests above this must use a stripe stub.
Output
## 1. Scenario table | Scenario | Traffic profile | Duration | p95 | p99 | Throughput | Error rate | |----------|-----------------|----------|-----|-----|------------|------------| | Baseline | 1 VU, 100 requests sequential | ~5 min | < 400ms | < 800ms | ~5 RPS observed | 0% | | Load | Ramp to 100 RPS over 5 min, hold 20 min | 25 min | < 800ms | < 2s | 100 RPS sustained | < 0.5% | | Stress | Ramp from 100 to 1,000 RPS over 20 min | 20 min | n/a (breaking point) | n/a | Find breaking point (when error rate > 5%) | record where error rate crosses 5% | | Spike | 100 RPS → 500 RPS in 30s, hold 5 min, drop back | 8 min | < 1.2s during spike | < 3s during spike | 500 RPS sustained | < 1% during spike (acceptable degradation) | | Soak | 50 RPS steady | 4 hours | < 800ms (no drift) | < 2s (no drift) | 50 RPS sustained | < 0.5% no upward trend | ## 2. Environment parity Test environment must match production in: instance class (currently CPU and memory under-provisioned in staging, fix before running stress / spike), database (use a clone of production data, not synthetic), and downstream services (inventory and email run real; Stripe runs sandbox up to 25 RPS, stub above that). Network latency may differ (test env in same region; prod has multi-region: note that p95 in test may underestimate by 20-40ms). Caching: must be warm before measurement begins. ## 3. Test data volume - Pre-seed 10,000 user accounts; each checkout consumes a cart, so every VU creates a fresh one-item cart in an unmeasured setup step (the soak alone is 50 RPS × 4 h ≈ 720,000 checkouts, far more than any pre-seeded cart pool) - Pre-warm cache with the top 100 products by purchase frequency - Use 100 distinct API keys to avoid rate limiting per key from test traffic - Stripe stub responds with realistic latency (200ms p95) and returns 1% failure rate to mimic real partner ## 4. Monitoring Capture per run: response time histogram (p50/p95/p99/max), throughput, error rate (broken down by HTTP status), CPU/memory of each downstream service, database connection pool utilization, cache hit rate, Stripe call rate. Alert thresholds during run: p95 > 1s for 2 min (warning), p99 > 3s for 1 min (warning), error rate > 1% for 30s (critical: pause the test). ## 5. Run cadence - Baseline: every release candidate (sanity check) - Load: every release candidate - Stress: every quarter, after major architectural changes - Spike: pre-Black Friday and pre-Cyber Monday (annual high-traffic events) - Soak: quarterly; weekly during active development of new persistence layer or connection-pooling work ## 6. Overall pass/fail "Performance is healthy" means: load test passes with margin (p95 < 600ms, not just < 800ms, to leave headroom for traffic variance); stress test finds a breaking point above 1.5x the highest expected peak (> 750 RPS, against the 500 RPS Black Friday spike); spike test shows recovery to normal latency within 90s of spike end; soak shows no upward drift in latency or memory over 4 hours. Any FAIL on these criteria blocks production release.
Common pitfalls
- Model conflates load and stress as 'increasing load'. Force the explicit distinction.
- Soak gets a 30-minute duration: that's not soak. Force hours.
- Spike test runs as a 5-minute ramp; the 'sudden' part gets lost. Force seconds-scale ramp.
- Environment parity gets glossed over with 'use a representative environment'. Demand specific named differences.
Tips
- Run baseline before EVERY load test: without a floor, you can't tell if performance regressed.
- Save the response-time histograms; year-over-year comparison surfaces drift the day-to-day misses.
- Pair with `k6-script-generator` to produce executable test code for each scenario.
- Pair with `performance-bottleneck-analysis` to interpret the results when something fails.
FAQ
Stress vs spike: what's the difference?
Stress finds the breaking point via gradual increase. Spike tests recovery from a sudden surge at a known level. Stress answers 'where do we break?'. Spike answers 'do we survive Black Friday's first 30 seconds?'.
How do I estimate think time?
Measure it from production data. If unavailable, start with 5-10 seconds between user actions and tune based on what produces realistic per-session request counts. Generic 'no think time' load tests are usually wrong.
Dealing with rate limits during load tests?
Either bypass them (test infrastructure mode) or stub the rate-limited dependency. Running load tests through a real rate-limited dependency tests the limiter, not your system.
Should performance tests block deploy?
Load test pass should block; stress/spike/soak run less frequently and gating CI on them is impractical. The standard is: load test in CI gates merge; quarterly stress test gates the production deploy schedule.