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

MetricDefinitionHealthy target
ThroughputRequests per second (RPS)As high as possible
p50 / p95 / p99 latencyPercentile response timep95 < 500 ms (typical)
Error rateFailed requests / total< 0.1% under load
Concurrent usersVirtual users active simultaneouslyMatches traffic model
Saturation% of resource capacity usedCPU < 80%, memory < 85%

Tools Overview

ToolLanguageBest for
k6JavaScript/TypeScriptDeveloper-friendly, CI integration
JMeterJava (GUI + code)Enterprise, complex scenarios
LocustPythonDistributed, Python-friendly teams
GatlingScala / JavaHigh-throughput, CI integration
ArtilleryJavaScriptSimple 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.