Performance testing measures how a system behaves under defined demand. Start with a clear user flow, workload and success criteria.
On this guide
Key metrics
| Metric | Meaning |
|---|---|
| Response time | Time from request start to response completion. |
| Throughput | Requests, transactions or data processed per unit of time. |
| Error rate | Percentage or count of failed operations. |
| Concurrent users | Users or sessions active at the same time. |
| Percentile | Value below which a percentage of results fall. |
| Saturation | Pressure on CPU, memory, connections, queues or another limit. |
If checkout p95 is 800 ms, 95% of measured checkouts completed in 800 ms or less. Averages can hide a slow minority, so report percentiles such as p50, p90, p95 and p99.
Workload model
- Which user journeys and endpoints matter?
- How many active and concurrent users are realistic?
- What arrival rate, think time and test-data variation are expected?
- How long should warm-up, steady state and cool-down last?
- What response-time, throughput and error thresholds must pass?
- Which system metrics and logs will be observed?
Common load patterns
Baseline
Small repeatable load for comparison.
Load
Expected normal and peak demand.
Stress
Increase demand to find limits and failure behaviour.
Spike
Sudden rise and fall in traffic.
Soak
Sustained load to find leaks and gradual degradation.
Breakpoint
Gradually increase load until objectives fail.
Simple k6 example
import http from 'k6/http';
import { check } from 'k6';
export const options = {
vus: 10,
duration: '30s',
thresholds: {
http_req_failed: ['rate<0.01'],
http_req_duration: ['p(95)<500'],
},
};
export default function () {
const response = http.get('https://test.example.com/api/products');
check(response, {
'status is 200': r => r.status === 200,
});
}
k6 run performance.js
Run and interpret
- Use an authorised, production-like environment.
- Prepare unique or reusable data deliberately.
- Run a baseline before the target load.
- Monitor client, application, database and infrastructure.
- Repeat the run and compare under similar conditions.
- Correlate slow requests with resource limits and logs.
Do not load-test production without explicit approval: a performance test can disrupt users, trigger alerts or create large amounts of data.
Tools
| k6 ↗ | Scriptable load testing with JavaScript. |
| Apache JMeter ↗ | GUI and CLI testing for several protocols. |
| Gatling ↗ | Code-based load testing and reports. |
| APM and metrics | Connect response results to server behaviour. |