QA Interview Hub · Knowledge base · Quizzes · Українська

Performance Testing

Types of performance testing

Load, stress, spike, soak: kinds of performance tests

The main performance tests are load, stress, spike and soak, which differ by the question they ask and the load shape. Load checks the expected load against goals, stress finds the limit where the system degrades or fails and how it recovers, spike checks a sudden short peak, and soak holds a steady level to expose memory and connection leaks. One load test does not answer the rest.

Performance · Test types

The 50-user test passed and the site still fell over at the sale. Which question was never asked?

Before a seasonal sale a shop runs a single test: 50 virtual users, 10 minutes, p95 within target. On sale day, after a mailing, traffic grows several times within a minute, the database connection pool runs out, the site returns errors, and long after the spike it still does not recover. One test answered the question "does the system work under a small steady load". There were more questions: where is the limit, what does a sudden peak do, does memory creep over a day. The kinds of performance tests differ by the question they ask and the load shape they apply for it.

How it works and why. Load has a shape over time, and the shape depends on the question. A test is defined by two things: the shape (level, ramp speed, duration) and the failure criterion (what counts as a bad result). The same user scenario under different shapes finds different defects: a jump exposes slow scaling and queues, a long steady level exposes leaks, and a gradual climb shows where the system breaks.

Load shapes over time

Loadnormal and peakStressgrows until it breaksSpikesudden jumpSoakhours at normal load
Figure 1. One scenario, four shapes. The shape decides which question gets an answer.
KindQuestionShapeWhat it finds
LoadDoes it hold the expected load within the goalsNormal and planned peakSLO violations at a realistic level
StressWhere is the limit and how does it fail and recoverGrowth beyond normal until it degradesThe saturation point, the failure mode, the recovery time
SpikeWhat a sudden jump doesA sharp short peakSlow scaling, queues, an avalanche of errors
SoakIs it stable for a long timeA steady level for hours or daysMemory and connection leaks, growing queues and disk

Two neighbouring kinds ask a different question rather than apply a different shape. Scalability: how performance changes when resources are added (instances, CPU), and whether throughput grows in proportion. Capacity: the highest load the system holds within the SLO, so resources can be planned ahead. The stress-test result (the saturation point) is the input for a capacity estimate.

Example: from one test to a set. A hypothetical system (the numbers are illustrative): an ordinary day is 40 requests per second (RPS), the planned sale peak is 120, and a mailing takes traffic to 300 within a minute. Goals: p95 < 500 ms and errors < 1 % at the peak; after the drop p95 returns to normal within minutes.

One test or a set with questions

Typical

One test for everything

50 VU, 10 minutes, a steady level. The report is green, but the limit, the reaction to a peak and the behaviour over hours stay unknown.

Better

A set where each test has a question

Load at 120 RPS, stress until it degrades, spike 40 → 300 RPS, soak at 40 RPS for several hours. Each test has its own failure criterion.

Figure 2. One green test does not prove the system survives the sale. Different load shapes give different answers.

The spike from this set is described in k6 as a scenario with ramping-arrival-rate: it controls the rate of iteration starts (here one iteration makes one request), not the number of users, so the peak is not smoothed out when the server slows down. This is a fragment of the options, the function with the request itself is not shown:

export const options = {
  scenarios: {
    spike: {
      executor: 'ramping-arrival-rate',
      startRate: 40, // an ordinary day: iterations (= requests) per second
      timeUnit: '1s',
      preAllocatedVUs: 300,
      maxVUs: 1500,
      stages: [
        { target: 40, duration: '2m' }, // background
        { target: 300, duration: '30s' }, // jump after the mailing
        { target: 300, duration: '3m' }, // hold the peak
        { target: 40, duration: '30s' }, // drop
        { target: 40, duration: '5m' }, // did p95 return to normal
      ],
    },
  },
  thresholds: { http_req_failed: ['rate<0.05'] },
};

How to read the results. For load, compare p95 and the error share with the goals. For stress, look for the point after which throughput stops growing and response time climbs steeply, and see how the system fails: does it return clear 503 responses with Retry-After, or hang. For spike, not only the peak matters but also how long p95 takes to return to normal after the drop. For soak, read trends (memory, connections, queue length, disk) rather than one number: a smooth rise under a steady load is a leak even if the test "passed".

Limits and alternatives. The result is honest only on an environment close to production: configuration, data volume, caches, integrations. Stress and spike in production without an agreement endanger real users. Pre-release tests do not replace observability in production (metrics, alerts, synthetic monitoring) and gradual rollouts (canary). A performance test is also not profiling: it shows what is slow under load, not where in the code. Timeouts, retries and API behaviour under limits are covered separately in the API chapter.

Typical mistakes.

  • One test at an "average" load and the conclusion "the system will hold everything".
  • A stress test with no stop criterion: nobody knows what counts as the limit.
  • A spike where the generator itself cannot create the peak: the test machine becomes the bottleneck.
  • A soak of a few minutes: leaks do not show in that time.
  • A test done only before the release: architectural problems are found when fixing them costs the most.
  • Comparing results from different environments, or after the data changed, with no baseline measurement.

Check yourself

A team ran a load test at the planned load and everything is green. Which two questions does it leave open?

Answer

Where the limit of the system is (stress: where throughput stops growing and whether the system fails clearly) and what a sudden peak does (spike). It also says nothing about stability over hours (soak).

How is stress different from capacity?

Answer

Stress asks "where and how does the system break and recover". Capacity answers "what is the highest load it holds within the SLO", so resources can be planned. The saturation point from a stress test is an input for capacity.

A soak test finished with p95 within target, but the application memory grew steadily the whole time. Did the test pass?

Answer

The test found a defect: a smooth rise under a steady load is a sign of a leak, and sooner or later the application runs out of memory. In soak you read the resource trend, not only the response time.

In an interview. Junior: Load checks the expected load, stress looks for the limit where the system degrades or falls, spike checks a sudden traffic jump, and soak holds a steady level for a long time to see memory leaks. Middle/Senior: I start from the question and only then choose the load shape and the failure criterion. For stress I find the saturation point and how the system fails and recovers, for spike I measure how long p95 takes to return to normal, for soak I read resource trends. I run the test on an environment close to production and complement pre-release tests with metrics and alerts in production.