Skip to content

Soak Testing

In one line

Soak testing applies normal load for hours/days — catches memory leaks, resource leaks, and gradual performance degradation.

In simple words

Soak testing (endurance testing) runs the system at normal or slightly elevated load for an extended period — typically hours or even days. It catches problems that only appear over time.

What soak testing catches:

  1. Memory leaks — memory usage slowly increases until OOM
  2. Resource leaks — file descriptors, database connections, threads not released
  3. Data accumulation — logs, temp files, cache growing unbounded
  4. Performance degradation — response time slowly increases over time
  5. Database issues — connection pool exhaustion, query plan degradation
  6. GC pressure — garbage collection pauses increasing over time

Process:

  1. Apply normal or slightly elevated load (e.g., 80% of peak)
  2. Run for hours or days (not minutes!)
  3. Monitor: memory, CPU, disk, response times, error rates
  4. Look for trends, not just spikes — is memory slowly growing?
  5. After the test, check if the system returns to baseline

Soak testing is often skipped due to time constraints, but it's the only way to catch leaks and degradation.

Example

javascript
// k6 soak test — 4 hours at 80% capacity
import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
  stages: [
    { duration: '10m', target: 80 },   // ramp up to 80 users
    { duration: '3h50m', target: 80 }, // soak for ~4 hours
    { duration: '10m', target: 0 },    // ramp down
  ],
  thresholds: {
    http_req_duration: ['p(95)<500'],
    http_req_failed: ['rate<0.01'],
  },
};

export default function () {
  http.get('https://api.example.com/products');
  sleep(2);
}

// Monitor during the test:
// - Is memory usage slowly increasing? (leak!)
// - Are response times degrading? (GC pressure?)
// - Are database connections growing? (pool leak!)
// - After ramp down, does memory return to baseline?

Soak test runs at 80% capacity for 4 hours. Watch for slowly increasing memory (leak), degrading response times (GC pressure), or growing connection counts (pool leak).

Common confusions

  • Confused with: load testing

    The difference: Load testing runs for minutes to verify the system handles expected traffic. Soak testing runs for hours or days at similar load to catch slow problems — memory leaks, resource leaks, degradation. Load testing catches immediate issues; soak testing catches slow, cumulative issues.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary