level 10 / performance-test-types
Load, Stress, Spike, Endurance
Understand the four types of performance tests and when to apply each.
Performance Test Types
The Four Types
Load Testing
Simulate expected production traffic over a sustained period.
Goal: Verify the system handles normal load within SLA.
Users: 500 concurrent
Duration: 30 minutes
Ramp-up: 5 minutes
Success criteria: p95 < 500 ms, error rate < 1%
Stress Testing
Push the system beyond its expected capacity to find the breaking point.
Goal: Discover where performance degrades and what fails first.
Users: ramp from 500 → 5000 (10× normal)
Success criteria: identify degradation point; observe graceful degradation vs crash
Spike Testing
Apply a sudden, sharp increase in traffic — then observe recovery.
Goal: Simulate flash sales, viral events, marketing emails going out.
Users: 100 → 2000 in 30 seconds → back to 100
Success criteria: system recovers within 60 s; no data loss
Endurance (Soak) Testing
Apply sustained moderate load over a long period (hours or days).
Goal: Find memory leaks, connection pool exhaustion, disk fill.
Users: 200 concurrent (normal load)
Duration: 8 hours
Watch: heap size, DB connections, response time trend
Key Metrics
| Metric | Definition | Healthy target |
|---|---|---|
| Throughput | Requests per second (RPS) | As high as possible |
| p50 / p95 / p99 latency | Percentile response time | p95 < 500 ms (typical) |
| Error rate | Failed requests / total | < 0.1% under load |
| Concurrent users | Virtual users active simultaneously | Matches traffic model |
| Saturation | % of resource capacity used | CPU < 80%, memory < 85% |
Tools Overview
| Tool | Language | Best for |
|---|---|---|
| k6 | JavaScript/TypeScript | Developer-friendly, CI integration |
| JMeter | Java (GUI + code) | Enterprise, complex scenarios |
| Locust | Python | Distributed, Python-friendly teams |
| Gatling | Scala / Java | High-throughput, CI integration |
| Artillery | JavaScript | Simple load tests, YAML config |
SLA vs SLO vs SLI
SLI (Service Level Indicator) — what you measure
"p95 response time = 320 ms"
SLO (Service Level Objective) — your internal target
"p95 response time must be < 500 ms"
SLA (Service Level Agreement) — contractual commitment
"99.9% uptime, p99 < 1 s — or penalty applies"
Performance tests verify SLIs meet SLOs — before the SLA is at risk.
Performance Testing in CI
# Run load test gate in CI (k6)
- name: Load test gate
run: k6 run --vus 50 --duration 2m load-test.js
# k6 exits non-zero if thresholds fail — CI fails automatically
Add performance gates to pipelines — catch regressions before production.