Soak test (also called endurance test) evaluates system performance over an extended period under a typical or expected load. The goal is to detect issues like memory leaks, resource exhaustion, or performance degradation that appear only after prolonged usage.
Reliability and performance tests
Soak test
1 min
Intro
Easy explanation
Checking if a bridge stays safe and stable after carrying traffic for many hours.
Scheme
Info
To better understand the terms in testing and tool k6 see vocabulary.
Key characteristics
- Sustained load: Keeps the system at a steady level of typical or peak expected traffic.
- Long duration: Focus on detecting slow degradation over hours.
- Stability focus: Identifies issues like memory leaks, gradual performance decline, and unreleased resources.
- Operational realism: Simulates long-running production-like conditions.
Practical examples
- Does the system remain stable after handling 500 users for 8 hours?
- Are there signs of memory exhaustion or degraded response times after prolonged execution?
Users and time
Number of virtual users:
Simulates typical load (e.g., 500 users) for extended periods.
Execution time:
4–8 hours or longer, enough to expose resource-related issues.
Example with tool k6
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '5m', target: 500 }, // ramp-up
{ duration: '8h', target: 500 }, // hold steady load
{ duration: '5m', target: 0 }, // ramp-down
],
thresholds: {
http_req_failed: ['rate<0.01'],
http_req_duration: ['p(95)<1000'],
},
};
export default function () {
const response = http.get('https://api.example.com/products');
check(response, {
'status is 200': (res) => res.status === 200,
});
sleep(1);
}