# Performance Testing

> Designs load and chaos tests (for example k6 and Toxiproxy) to verify latency, throughput, and failure behavior. Use this skill when proving system performance under load or injected faults. Do not use when/for unit/mutation testing (use writing-tests or mutation-testing) or micro-optimizing React renders (use react-development).

- Skill: `jagreehal/performance-testing` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add jagreehal/performance-testing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jagreehal/performance-testing/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: jagreehal (https://skillmd.com/u/jagreehal)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/jagreehal/performance-testing

---


# Performance Testing

## Critical rules

- Progressive profiles only: **Smoke → Load → Stress → Soak → Spike**. Never jump to stress first.
- Encode SLOs as k6 **`thresholds`** that fail the run — eyeballing is not a gate.
- Every VU iteration includes **`sleep()`** think time (prevents accidental DDoS).
- Send **`traceparent`** (+ load-test id) so slow percentiles map to OpenTelemetry spans.
- Prove resilience with chaos (latency/failure injection); pair `resilience` patterns.
- Run load in CI to catch regressions. Diagnose bottlenecks via traces, not guesses.
- Before full profile scripts or chaos helpers, read the matching resource below.

## Workflow

1. Confirm unit/integration pass. Failing smoke with 1 VU = functional bug, not a perf problem.
2. Write **smoke** (1 VU, ~1m, low error rate). Pass before higher load.
3. Add **load** at expected traffic with p95/p99 and error-rate thresholds.
4. Escalate: **stress** (find break point), **soak** (hours, watch memory/leak), **spike** (burst + recovery).
5. Correlate: inject W3C `traceparent` and `x-load-test-id`; query traces for pool exhaustion, N+1, rate limits.
6. Chaos: inject latency/failures (in-process helpers or Toxiproxy). Verify timeouts, retries, circuit breakers fire. Before implementing injectors, read [references/chaos.md](references/chaos.md).
7. CI: run load on main/nightly; upload JSON/HTML artifacts; fail on threshold breach.

## Resources

- [references/load-profiles.md](references/load-profiles.md) — smoke/load/stress/soak/spike options, thresholds, k6 CLI, tracing headers. Read when authoring scripts.
- [references/chaos.md](references/chaos.md) — latency/failure helpers, Toxiproxy, chaos scenarios, CI sketch. Read when proving resilience under fault.
- [references/rationalizations.md](references/rationalizations.md) — excuse→reality, pitfalls, red flags. Read when tempted to skip a gate.

## Validation

- [ ] Smoke passed before higher profiles
- [ ] Each profile has SLO `thresholds`; VUs use `sleep()`
- [ ] Requests carry `traceparent` (+ load-test id)
- [ ] Resilience patterns exercised by chaos
- [ ] Load runs in CI; bottlenecks diagnosed via traces

## Constraints

- Not for unit/mutation tests (`writing-tests`, `mutation-testing`) or React render micro-opts (`react-development`).
- Pyramid placement of load/chaos: `testing-strategy`. Patterns under test: `resilience`. Trace correlation: `observability`. Bottleneck follow-up: `debugging-methodology`.

