Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 36 ยท Getting Started

Types of Load Tests

Learn the main load test types, smoke, average load, stress, spike, soak and breakpoint tests, what each one finds, and how to express each as k6 stages.

"Load test" is often used as a catch-all, but there are several distinct kinds of test, each answering a different question. Choosing the right one saves time: a smoke test takes seconds and catches broken scripts, while a soak test runs for hours and catches leaks nobody sees in a five-minute run. This lesson names the types, shows the traffic shape of each, and expresses them in k6 using stages, which you will study properly in Options and Stages.

The traffic shapes

Every test type is just a different curve of virtual users over time.

The stand-in near the end of this lesson draws these curves as text.

Smoke test

A smoke test uses a tiny load, one to a few VUs for under a minute. Its job is not to measure performance; it checks that the script works and the system responds at all. Run it first, every time you change a script, and run it in CI on every commit because it is cheap.

JavaScript
export const options = { vus: 1, duration: '30s' };

Average-load test

An average-load (or simply load) test simulates a typical busy day: ramp up, hold the normal number of users for a while (5 to 60 minutes), then ramp down. It tells you whether the system meets its performance targets under expected traffic.

JavaScript
export const options = {
  stages: [
    { duration: '2m', target: 50 },  // ramp up
    { duration: '10m', target: 50 }, // plateau
    { duration: '1m', target: 0 },   // ramp down
  ],
};

Stress test

A stress test pushes beyond normal load, in steps, to learn how the system behaves under pressure: do response times degrade gracefully, or does it start returning errors? It also shows how it recovers when load drops.

JavaScript
export const options = {
  stages: [
    { duration: '2m', target: 50 },
    { duration: '5m', target: 50 },
    { duration: '2m', target: 100 },
    { duration: '5m', target: 100 },
    { duration: '2m', target: 200 },
    { duration: '5m', target: 200 },
    { duration: '5m', target: 0 },
  ],
};

Spike test

A spike test jumps to a very high load almost instantly, holds briefly, and drops. It models a flash sale, a viral post or a retry storm. Many systems that are fine at steady high load fail on a sudden surge because caches are cold, autoscaling is late, or connection pools are too small.

JavaScript
export const options = {
  stages: [
    { duration: '10s', target: 10 },
    { duration: '10s', target: 500 }, // sudden surge
    { duration: '1m', target: 500 },
    { duration: '10s', target: 10 },
    { duration: '2m', target: 10 },   // watch the recovery
  ],
};

Soak (endurance) test

A soak test holds a moderate load for hours. It finds problems that only appear with time: memory leaks, file handles never closed, a database that fills up, log files that eat the disk, connection pools that slowly run dry. Keep the load realistic, not extreme; the point is duration.

JavaScript
export const options = {
  stages: [
    { duration: '5m', target: 40 },
    { duration: '4h', target: 40 },
    { duration: '5m', target: 0 },
  ],
};

Breakpoint test

A breakpoint test keeps increasing load until something breaks, to find the maximum capacity. Instead of VUs it often uses an arrival rate (requests per second), so the test keeps pushing even when the server slows down. You will see that in Arrival-Rate Executors.

Test Load Typical length Question it answers
Smoke Minimal Seconds to 1 min Does the script and system work at all?
Average load Expected 10 to 60 min Do we meet targets on a normal day?
Stress Above expected 20 to 60 min How does it degrade, does it recover?
Spike Sudden extreme Minutes Can it survive a surge?
Soak Moderate 2 to 24+ h Does it stay healthy over time?
Breakpoint Rising until failure Until it breaks What is the maximum capacity?

A stand-in that shapes the load

The program below is not k6. It turns a list of stages, in the same format as k6's stages, into the number of virtual users at each second of a (very compressed) test, using linear interpolation. This is the calculation k6 performs for the ramping-vus behaviour, and it lets you print the shape of any test type before running it.

Node.js Stand-in: compute the VU curve from stages

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

Read the bars as VUs. The load test shows a ramp, a long flat plateau and a ramp down; the spike jumps from 10 to 100 in a few ticks. Real k6 does the same arithmetic continuously and adds or removes VUs as the curve moves.

Choosing a test

A sensible progression for a new service: start with a smoke test, then an average-load test to set a baseline, then stress and spike tests to learn the limits, and a soak test before a major launch. Keep the scripts the same and change only the options, which is why putting the traffic shape in options or in environment-selected configuration pays off (see Test Data and Environment Variables).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which test checks quickly that your script and system work at all?

    A smoke test uses minimal load for a short time to catch broken scripts and obvious failures.
  2. 2. Memory leaks that only show up after hours are best found with a:

    Soak (endurance) tests hold a moderate load for a long time to reveal resource leaks and slow degradation.
  3. 3. What does a spike test model?

    Spike tests jump to a very high load almost instantly, like a flash sale or viral link.
  4. 4. In k6, what is the usual way to describe a ramp up, plateau and ramp down?

    stages is an array of { duration, target } steps that moves the VU count toward each target.

Summary

  • Each test type is a different load curve that answers a different question.
  • Smoke: minimal load, correctness. Load: expected traffic. Stress: beyond normal. Spike: sudden surge. Soak: long duration. Breakpoint: find the limit.
  • All of them are expressed as stages (or scenarios) in options.
  • Start small with a smoke test and grow; keep the script, change the options.

Next: Virtual Users and Iterations