Glossary · Performance
Load testing
Also called: load test, load tests, load-testing
Definition
Performance testing that runs a system at its expected real-world traffic to check response times, error rates and throughput against agreed targets.
Load testing puts a system under the traffic you actually expect, typically normal peak load, and measures how it behaves: latency percentiles, error rate, throughput and resource use. The question it answers is “does it meet its performance targets under the load we plan for?” It is not about breaking the system; that is stress testing.
Example (k6)
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '2m', target: 100 }, // ramp up to 100 virtual users
{ duration: '10m', target: 100 }, // hold at expected peak
{ duration: '1m', target: 0 }, // ramp down
],
thresholds: {
http_req_duration: ['p(95)<500', 'p(99)<1200'],
http_req_failed: ['rate<0.01'],
},
};
export default function () {
const res = http.get('https://staging.example.com/api/products');
check(res, { 'status is 200': (r) => r.status === 200 });
sleep(1); // think time between iterations
}
If either threshold is breached, k6 exits with a non-zero code, so the same script can act as a gate in CI.
Load, stress, soak and spike
| Type | Load profile | Question it answers |
|---|---|---|
| Load | Expected peak, held steady | Do we meet targets at normal peak? |
| Stress | Increasing beyond expected | Where and how does it break, and does it recover? |
| Soak | Normal load for hours | Does it degrade over time (leaks, pool exhaustion)? |
| Spike | Sudden jump, then drop | Does it survive a burst and scale back? |
Getting it right
- Model real traffic. Use the mix of endpoints, payload sizes and think times you see in production analytics, not one URL hammered in a loop.
- Use a production-like environment. Results from an undersized staging box tell you about that box.
- Judge by percentiles, not averages. An average hides the slow tail that users actually complain about.
- Watch the server side too. CPU, memory, database connections and queue depth explain why latency moved.
- Agree the targets first. Without a stated goal such as “p95 under 500 ms at 200 requests per second”, a load test produces numbers but no verdict.