Bookmarks
ReferenceTesting (QA)Verified

Load testing

Load testing checks how a system behaves under load. This reference covers metrics and percentiles, test types, load models, k6, JMeter and analysis.

checked 6 Nov · next check 13 Nov · 59 min read

Sections
11
Reading
59 min
Current version
2.3.0
Written from
grafana.com/docs/k6/latest

Check status of the reference

Verified 6 Nov · next check 13 Nov

The sections were compared with the release notes, the check found nothing, and all source links respond.

  1. Verified
  2. Scheduled check

What a load test is and how it works

Load testing is a kind of performance testing: the system receives a stream of requests from virtual users, and you check how well it copes with a given load — response time, throughput, error rate and resource usage.

You test the behaviour of the system, not the code: does it hold up under the expected flow of visitors, and does it degrade at peak? In ISTQB CT-PT, load testing is one of the performance test types: the system receives increasing levels of realistic load from a specified number of concurrent users or processes. It differs from a stress test, which looks for the limit and for behaviour beyond what the system can handle (see the section “Load test types”).

How a test is built

A test has three parts. The load generator starts virtual users (VUs): each one runs a scenario in a loop, sending requests and waiting. They put pressure on the system under test: the load balancer, the application and the database. Metrics come from two sides: client-side metrics, response time and error rate, which the generator knows, and server-side metrics, CPU, memory and database queries, from system monitoring. The analysis puts the two sides together: a rise in latency coincides with CPU or database saturation.

Client metrics come from the load generator, server metrics from monitoring the system under test.

According to ISTQB, a load generator is a separate group of tools: the load has to be modelled and applied to the system, which takes dedicated tools and often a separate machine. The tool also collects measurements as it goes: for protocol-level scenarios these cover server and network time, so server monitoring is set up separately. Keep an eye on the generator itself too: if it runs short of CPU, response times are overstated (see the section “Checklist”).

The steps of a test

A load test is a series of steps, not a single run. First come the goals: what you are testing and against which threshold, for example 95% of requests faster than 300 ms and fewer than 1% errors. Then the load model: how many virtual users and at what request rate, open or closed model (see the section “Load models”). Then the scenarios: which actions a user repeats. Next, the environment and data: a test environment close to production, with prepared data. The last three steps are the run, the analysis of results and the report (see the section “Analysing results and reporting”).

  1. Goals and thresholds: the expected load and a pass/fail criterion
  2. Load model: open or closed, and the profile over time
  3. Scenarios: realistic user and data flows
  4. Environment: a test environment and monitoring close to production
  5. Run: a smoke test first, then the main run
  6. Analysis and report: comparison with the baseline and the thresholds

The first run is a smoke test: minimal load, to check that the scenario works and returns what is expected. After that comes the main run against the thresholds, followed by a comparison with the baseline run: without a baseline you cannot tell whether you improved the system or broke it.

javascripta k6 scenario: 20 virtual users for one minute
import http from 'k6/http';import { check } from 'k6'; export const options = {  vus: 20,  duration: '1m',  thresholds: {    http_req_failed: ['rate<0.01'],    http_req_duration: ['p(95)<300'],  },}; export default function () {  const res = http.get('https://example.com/api/items');  check(res, { 'status 200': (r) => r.status === 200 });}

The thresholds are written right in the test: http_req_failed keeps the error rate below 1%, and p(95) requires 95% of requests to be faster than 300 ms. k6 checks the metrics against the thresholds itself and shows at the end of the run whether the test passed.

How k6 differs from JMeter

The tool is a load generator, and for most tasks either will do. k6 is a command-line tool: the scenario is written in JavaScript, and the load is described with options and executors. JMeter is a Java application: a test is assembled from elements in a graphical interface and stored in a .jmx plan file. Everything else follows from that.

Featurek6Apache JMeter
ScenarioJavaScript code, stored in git and code-revieweda .jmx plan, built in the graphical interface
ProtocolsHTTP, WebSocket, gRPC; more through extensionsHTTP, JDBC, FTP, LDAP, JMS; more through plugins
Running in CIa single k6 run command, thresholds in the exit codenon-GUI mode, HTML report
Generator resourceslow: one process handles thousands of VUshigher: one thread per virtual user
Resultsa summary at the end, streams to JSON, CSV or platformsa CSV or XML file, an HTML report after the run
Checks and thresholdschecks and thresholds in the script itselfassertions and listeners in the plan elements

Choose k6 when tests live alongside the code: scenarios in git, thresholds in CI, an automatic run before each release. Choose JMeter when the protocols are not HTTP, such as a database, LDAP or JMS, or when the team is used to building tests in a graphical interface. For protocol-level scenarios in both tools, response-time metrics cover only the server and the network: what happens inside the browser is not visible (see the sections “k6: scripts and running”, “Apache JMeter”).

What you need to know first

A load test sends real HTTP requests, so you need a reference on HTTP and REST: methods and response codes, headers, cookies. Basic JavaScript is enough, at the level of functions and imports: a k6 scenario is ordinary code. Latency metrics and percentiles are covered in the section “Metrics: latency, percentiles, RPS”.

Section sources

the section is written from these pages

Checklist

The checklist is a list of checks to go through before every planned load run and to keep at hand when reviewing results. It has 6 groups: goals, load model, environment, generator, run and results.

Each item is worded as an action with a verifiable outcome: the answer is “done” or “not done”. Go through the groups in order: goals first, then the model, the environment and the generator, and only after that the tests, from the smoke test to the main run.

Goals and thresholds

A run starts with a goal: the threshold is expressed through p95, the 95th percentile of response time, and through the share of failed requests.

  • State the goal of the run in one sentence: check a release, compare with the baseline, find the system’s limit
  • Write the thresholds for response time and error rate right in the script — they also become the pass/fail criterion
  • Agree the thresholds with the team and decide who is told about a failure, and how
  • Decide whether to stop the run when errors pile up: in k6, a threshold with abortOnFail does this
javascriptthresholds in a k6 script
export const options = {  thresholds: {    http_req_failed: ["rate<0.01"],    http_req_duration: ["p(95)<500"],  },};

Load model

The load model describes how many users arrive at the system and at what rate. The data for it comes from monitoring, not from expectations.

  • Take the request rate and scenarios from real data: analytics and monitoring show the system’s typical traffic
  • Check the scenarios against real user journeys, not expected behaviour
  • Prepare a minimal version of each scenario for the smoke run
  • Plan each test at least twice in a row: the repeat is useful when you assess the results

Environment

A test environment with cut-down resources will show neither realistic latency nor the system’s limits, so a run on it proves nothing.

  • Check that the environment is close to production in composition and resources
  • Agree the time and duration of the run with the owners of the environment
  • Turn on server monitoring: system metrics are collected at the same time as the test metrics
  • Prepare test data in a volume comparable to production

Generator

The load generator is the machine that produces the load. If its resources are at the limit, measurements are distorted before the load even reaches the system.

  • Estimate the number of virtual users (VUs) from the machine’s resources: CPU, memory, network
  • Check the open-file limit (ulimit -n) before the run, not from an error in the middle of it
  • Estimate the limit you need: the maximum number of VUs multiplied by the number of requests per iteration
  • If the machine cannot sustain the load, spread the generation across several machines
bashon the generator machine
# check the open-file limitulimit -n# raise it for the generator sessionulimit -n 5000

Run order

The order saves hours: first check the script at minimal load, and only then run the main test.

  • Do a smoke run at minimal load — it catches script errors in minutes rather than hours
  • Make sure the smoke run passed cleanly, and only then start the main one
  • Watch the metrics in real time and stop the test if errors start pouring in
  • Do not change the environment or the data during a series of runs: the comparison would lose its meaning

Results and report

Results are valuable only when compared with something: the baseline run and repeatable conditions are the basis of your conclusions.

  • Compare the results with the baseline run: without a baseline, trends and regressions are invisible
  • Compare two runs on an unchanged system: the spread should fall within the tolerance, otherwise there is nothing to compare
  • Keep the results for a long time: old runs become the future baseline
  • Record the run conditions, the metrics and the release decision in the report

A completed checklist does not guarantee a successful run, but it rules out reasons to redo it: an unprepared environment, a generator that fell over, results that cannot be compared. For what to do with the numbers after a run, see the section “Analysing results and reporting”; common methodological mistakes are covered in the section “Common mistakes in approach”.

Section sources

the section is written from these pages

Metrics: latency, percentiles, RPS

Four numbers matter in load test results: response time in percentiles, throughput, error rate and the number of virtual users. Average response time is a poor guide: it hides the slowest requests, so goals are expressed through p95 and p99.

In this reference the load generator is k6, so the examples and metric names come from it. The same quantities are calculated in Apache JMeter, just under different names. Server metrics — CPU, memory, the database — are collected by monitoring; how to connect them is covered in the section “Analysing results and reporting”.

Response time and percentiles

A percentile is the value below which a given share of measurements falls. p95 = 500 ms means that 95% of requests responded faster than 500 ms, and one in twenty was slower still. The median is p50: half of the requests are faster than it.

The average hides the tail. It mixes fast and slow requests, and a rare but heavy failure barely changes the overall picture. ISTQB explicitly warns that the average is often skewed by outliers, and the 90th percentile is taken as a target because it reflects the experience of most users. Minimum and maximum are of little use: the minimum is almost always the same, and the maximum is a random outlier.

A worked example. In one minute the system answered 10,000 requests: 9,850 had a response time of 100–200 ms, 100 took about 700 ms, and 50 took 2 s or more. The median is about 150 ms and the average about 165 ms: the rare slow requests barely move the average. p99 is about 700 ms: the percentile shows the tail that the average hides. That is why goals are expressed through the tail — “p99 no more than 1 s” — rather than through the average.

For a Trend metric, the k6 summary prints all of these values at once: avg, min, med, max, p(90), p(95). Look at p(90) and p(95), and at p(99) when requirements are strict.

ValueWhat it tells youWhat it is good for
avgthe average over all requestsa trend, not a goal
med (p50)half of the requests are fasterthe typical experience
p9090% of requests are fastera baseline goal
p9595% of requests are fastera common threshold
p9999% of requests are fasterthe tail: peaks and heavy requests
maxthe slowest requestan upper bound, often an outlier

Throughput

Throughput is how much work the system does per second. It is measured with two metrics: requests per second (RPS) and iterations per second. An iteration is one pass through the scenario by a virtual user; it may contain several requests.

The request rate alone says little: RPS rising alongside latency is a sign of saturation, not success. Compare RPS with the response-time percentiles and the number of VUs: at what load, and at what cost in latency, does the system sustain the flow?

Errors and what counts as one

The error rate is the share of requests that ended in failure. In k6, the http_req_failed metric counts a request as failed when the response code is outside the 200–399 range. You also need to check the content: an HTTP 200 with an error message in the body is an error too. That is what checks are for; their pass rate is counted separately, and a failed check does not fail the test — unlike a threshold.

An error is not always visible in the response code: a timeout and a dropped connection also count as failed requests. Watch dropped_iterations separately — iterations that k6 could not start because there were no free VUs or the allotted time ran out. A steady stream of them means the generator cannot keep up with the specified rate.

Virtual users

A virtual user (VU) is one thread of the scenario: it repeats iterations with its own data. A VU is not a person: it has no pauses to read the screen, so the load from one VU is often higher than from a real visitor. The vus metric shows the number of active VUs, and vus_max shows how many VUs are allocated to the test. Users and requests are different things: 100 VUs with a 1 s pause produce less RPS than the same 100 VUs without pauses. The rate at which iterations start is set by executors, covered in the section “k6 scenarios and executors”; load models are covered in the section of the same name.

Built-in k6 metrics

k6 collects metrics itself: general ones for any protocol, and HTTP metrics when the test makes HTTP requests. A metric is not a single number but a stream of measurements of a particular type: the type determines what the summary prints and which aggregates are available in thresholds.

MetricTypeWhat it shows
http_req_durationTrendrequest time: sending + waiting + receiving
http_req_waitingTrendtime to first byte (TTFB)
http_req_failedRateshare of failed requests (outside 200–399)
http_reqsCounternumber of HTTP requests
iterationsCounternumber of completed iterations
iteration_durationTrenditeration time, including setup and teardown
vusGaugehow many VUs are active
vus_maxGaugehow many VUs are allocated to the test
checksRateshare of passed checks; the summary shows checks_total, checks_succeeded, checks_failed
dropped_iterationsCounteriterations that did not start: not enough VUs or time ran out
data_receivedCounteramount of data received
data_sentCounteramount of data sent

Metric types and custom metrics

k6 has four types. A Counter sums values: the number of requests, the volume of traffic. A Gauge stores the last, maximum and minimum value: active VUs. A Rate tracks how often a value was non-zero: the error rate. A Trend calculates statistics over a set of values — average, median, percentiles: response time.

javascriptcustom metrics in a k6 script
import http from 'k6/http';import { Trend, Counter } from 'k6/metrics'; // a custom metric is created in the init contextconst searchTime = new Trend('search_time');const emptyResults = new Counter('empty_results'); export default function () {  const res = http.get(    'https://example.com/api/search?q=k6',  );  searchTime.add(res.timings.waiting);  if (res.json('total') === 0) {    emptyResults.add(1);  }}

Custom metrics are created in the init context, before the virtual users start: this lets k6 check up front that thresholds refer to metrics that exist. Inside the iteration, add a value with the add() method. Measure what matters to the business: search time, the share of empty results, response size.

Thresholds as a way to state goals

A threshold is a pass/fail criterion written right in the script: a performance requirement stops being words in a ticket and becomes a verifiable condition. If even one threshold is not met, the test ends with a “failed” status and a non-zero exit code.

javascriptthresholds in a k6 script
export const options = {  thresholds: {    // no more than 1% errors    http_req_failed: ['rate<0.01'],    // 95% of requests faster than 500 ms,    // 99% faster than 1 s    http_req_duration: ['p(95)<500', 'p(99)<1000'],  },};

The expression depends on the metric type: rate for a Rate, count and rate for a Counter, value for a Gauge. A Trend has the most aggregates: avg, min, max, med and p(N). Put several thresholds for one metric in a single array: k6 silently ignores a repeated key in an object. Take the numbers from agreed requirements, not from examples.

The numbers from the summary and the thresholds are the input for analysis. How to relate them to server load and where to look for the bottleneck is covered in the section “Analysing results and reporting”.

Section sources

the section is written from these pages

Load test types

The type of a load test sets the shape of the load: how high it rises, how quickly it reaches that level and how long it holds. [[k6]] distinguishes six types — from a short smoke test to a breakpoint test, which grows until the system fails — and you should start with smoke and run the heaviest types last.

Six types and what each one looks for

The load profile is described by three parameters: the target level, meaning how many virtual users or requests per second; how quickly it is reached; and the hold time. Different shapes create different risks, so one run does not replace the others: a system may sustain steady load for hours and still fall over under a short spike.

TypeLoad shapeDurationWhat we look for
smokeminimal: a few virtual usersseconds or minuteswhether the scenario and the system work at minimal load
loadaverage production load5–60 minuteswhether the system sustains a normal day without degrading
stressabove average: sometimes by 50–100%5–60 minuteshow the system degrades and whether it survives overload
spikevery high, almost no ramp-upa few minuteswhether the system survives a sudden surge
soakaverage, as in the load testhours or daysmemory leaks, response-time degradation, resource exhaustion
breakpointgrows until the system failsas long as it takesthe capacity limit: where the system breaks

Smoke and load tests are the basis: they run on every code change. Stress, spike, soak and breakpoint tests are chosen according to the risks of the particular system — seasonal sales, rush hours, processing deadlines, capacity requirements.

Curve height is the load level, length is time; the numbers are illustrative.

Where to start

The k6 documentation suggests an order: smoke first, then a load test at an average level, then the other types according to risk. Each next type is more expensive and more dangerous than the previous one, and without a smoke test you risk spending an hour of heavy load hunting for a typo in the scenario.

  1. smoke — check that the scenario works and the thresholds hold at minimal load;
  2. load — make sure the system sustains normal load without degrading;
  3. then by risk: stress if a surge above normal is expected, spike if the load arrives suddenly, soak if the system has to run for days without a restart;
  4. breakpoint — several times, to find the capacity limit and set production thresholds.

How this maps to ISTQB types

The ISTQB performance testing syllabus describes the same work with different terms, and both naming systems turn up in tickets. Breakpoint looks for the same limit as capacity testing, only experimentally, by increasing the load.

Type from the table aboveISTQB term
loadload testing
stressstress testing
breakpointcapacity testing
spikespike testing
soakendurance testing
—scalability testing
—concurrency testing

Profiles in k6

The shape of the load in a k6 scenario is set by the stages array: each stage ramps to a target over a duration (executors are described in the section “k6 scenarios and executors”). There are usually three stages: ramp-up, plateau and ramp-down; a spike test has no plateau. The difference between the types lies in the numbers in the stages.

javascriptstress test: a plateau above average
export const options = {  // a longer ramp-up than in the load test  stages: [    { duration: '10m', target: 200 },    { duration: '30m', target: 200 },    { duration: '5m', target: 0 },  ],};
javascriptspike test: a peak and a fast ramp-down
export const options = {  // a sharp rise to the peak with no plateau  stages: [    { duration: '2m', target: 2000 },    { duration: '1m', target: 0 },  ],};

Section sources

the section is written from these pages

Load models: open and closed

A load model is the rule that decides when test iterations start: from a number of virtual users or from a set rate. The choice determines what happens when the system slows down. A closed model reduces the load by itself; an open model keeps its pace and builds up a queue.

In a closed model you set the number of virtual users (VUs). Each one starts its next iteration only after the previous one has received a response. In k6 these are the constant-vus and ramping-vus executors. In an open model you set the arrival rate: iterations start on schedule, regardless of responses. These are constant-arrival-rate and ramping-arrival-rate.

The pace is fixed in advance: a slowdown does not reduce the load, it builds up a queue.

Closed model

Each VU lives in a loop: request, response, pause, request again. While the system responds quickly, the load mirrors the behaviour of real users. When responses slow down, iterations get longer and fewer new requests are sent, so the load drops just when you want to see the system’s limit. In the literature this effect is called coordinated omission.

javascriptclosed model in k6
import http from 'k6/http';import { sleep } from 'k6'; export const options = {  scenarios: {    browse: {      // closed model: VUs set the pace      executor: 'constant-vus',      vus: 20,      duration: '1m',    },  },}; export default function () {  http.get('https://test.k6.io/');  // the user reads the page  sleep(3);}

Open model

The constant-arrival-rate executor with rate: 10 and timeUnit: '1s' starts an iteration every 100 ms, even if the previous response has not arrived yet. System responses no longer affect the load: it matches the set rate exactly, for example a target RPS. An iteration starts only when a VU is free, so estimate the pool in advance: preAllocatedVUs is the median iteration duration multiplied by rate, plus a margin. A trial run will show whether the pool is big enough.

javascriptopen model in k6
import http from 'k6/http'; export const options = {  scenarios: {    checkout: {      // open model: 30 iterations per second      executor: 'constant-arrival-rate',      rate: 30,      timeUnit: '1s',      duration: '1m',      preAllocatedVUs: 50,      maxVUs: 100,    },  },}; export default function () {  http.get('https://test.k6.io/contacts.php');}

Think time

Think time is the sleep() pause between requests within an iteration, when a user reads a page or fills in a form. In a closed model this pause sets the pace: the longer the sleep, the fewer requests per second a single VU produces. In an open model the pace is already set by rate and timeUnit, so a sleep at the end of an iteration is unnecessary: it only lengthens the iteration and needs more VUs. The ISTQB formula shows the same relationship: throughput = number of VUs / (processing time + think time).

How many users and what rate

Take the number of users from analytics, not from expectations. The k6 formula for the baseline is: concurrent users = sessions per hour × average session duration in seconds / 3,600. Divide the monthly session count by 720, the number of hours in 30 days, before calculating. Use hourly slices: a daily or monthly average hides the peaks.

SliceSessionsSession durationConcurrent users
Monthly average2,59182 s0.08
Peak hour99092 s25.3

In the k6 documentation example, a site with average monthly traffic has 0.08 concurrent users, but in the peak hour it has 25.3. That is a difference of hundreds of times: a test at average traffic says nothing about the peak. Add a margin to the peak figure and check it with a separate spike test.

Operational profile and load profile

An operational profile describes how people and other systems interact with the system: roles, typical tasks and the number of users of each role per unit of time. Collect the data from production monitoring, analytics, interviews with product owners and functional requirements; check ready-made profiles against the same sources before the run. This is the approach recommended by the ISTQB CT-PT syllabus.

  1. Decide which data you need: roles, tasks, frequencies
  2. Collect the data: analytics, monitoring, interviews
  3. Evaluate the data and build the profiles

Several operational profiles are combined into a load profile: how many instances, usually VUs, run each profile and at which points in the test. Over time the profile always looks the same: ramp-up, plateau, ramp-down. The ramp-up warms caches and connection pools, the plateau is where you measure, and the ramp-down shows recovery. In k6 the stages array defines the steps; sharp spikes are made with steps such as “+100 VUs every 5 minutes”.

FeatureClosed modelOpen model
What you setnumber of VUsrate: iterations per second
k6 executorsconstant-vus, ramping-vusconstant-arrival-rate, ramping-arrival-rate
System slows downthe rate drops by itselfsame pace, iterations are dropped
Overload shows asa drop in RPSa rise in dropped_iterations
When to chooseuser behaviour: sessions, authenticationrequest flow: RPS, peaks, queues

Choose a closed model when you reproduce the work of specific users: scenarios with state, authentication, a shopping basket. Choose an open model when the goal is to measure whether the system can withstand a given flow and what happens to queues at the peak. Executor parameters are covered in the section “Scenarios and k6 executors”; choosing a test type for your goal is in the section “Types of load tests”.

Section sources

the section is written from these pages

Scenarios and k6 executors

A scenario in k6 is an entry in options.scenarios that describes one load shape: which executor drives it, how many virtual users and iterations it starts, and for how long. One test can run several scenarios with different load shapes, for example reads and writes at different rates.

The executor is the main field of a scenario: it sets the load model. In a closed model, a fixed number of VUs run iterations one after another; in an open model, iterations start at a set rate regardless of how the system responds. For the difference between the models, see the load-testing reference, section “Load models: open and closed”.

How a scenario is structured

Each scenario in options.scenarios has a key, which is the scenario name. It appears in the final report and in the scenario tag of metrics. The only required field is executor; the other fields depend on the chosen executor.

javascriptoptions inside the script
import http from 'k6/http'; export const options = {  scenarios: {    browse: {      executor: 'constant-vus',      vus: 20,      duration: '5m',      tags: { role: 'read' },    },    checkout: {      executor: 'shared-iterations',      vus: 5,      iterations: 100,      startTime: '2m',      exec: 'checkoutFlow',      tags: { role: 'write' },    },  },}; export default function () {  http.get('https://example.com/');} export function checkoutFlow() {  http.post('https://example.com/checkout/');}

The exec field names the exported function that the scenario runs; without it the scenario runs default. The startTime field delays the start of a scenario from the start of the test: here writes join after two minutes, when reads are already running. The tags field adds labels to the scenario’s metrics, which makes it easy to separate reads from writes during analysis. Scenarios run in parallel; to imitate a sequence, choose suitable startTime values.

Six executors

Executors fall into two groups. Four work with VUs and iterations: a VU tries to run iterations as often as it can. The two arrival-rate executors work with time: they start as many VUs as needed so that iterations begin at the set rate.

ExecutorModelWhen to use it
shared-iterationscloseda total number of iterations is shared between VUs; short runs
per-vu-iterationsclosedeach VU runs its own number of iterations; warm-up, login
constant-vuscloseda fixed number of VUs for a set time; a simple load step
ramping-vusclosedthe number of VUs changes by stage; finding the degradation point
constant-arrival-rateopena constant rate of iteration starts; testing against a realistic profile
ramping-arrival-rateopenthe start rate changes by stage; RPS steps

If your target load is measured in requests per second, use the arrival-rate executors. A closed model with a fixed number of VUs lowers the rate when responses are slow, because VUs wait for their iterations to finish, so the server never shows its real breaking point.

Rate steps: ramping-arrival-rate

For arrival-rate executors, rate sets the number of iteration starts per timeUnit (1s by default). The rate may need more VUs than are running, so the required preAllocatedVUs field allocates VUs in advance, and the optional maxVUs sets the ceiling k6 can grow to.

javascriptrate growing by stage
export const options = {  scenarios: {    api: {      executor: 'ramping-arrival-rate',      startRate: 50,      timeUnit: '1s',      preAllocatedVUs: 50,      maxVUs: 200,      stages: [        { target: 100, duration: '1m' },        { target: 100, duration: '3m' },        { target: 300, duration: '2m' },      ],    },  },};

The test starts at a rate of 50 iterations per second (startRate), reaches 100 within a minute, holds a three-minute plateau and then rises to 300. Each element of stages is a transition to target over duration; stages follow one another without pauses. Iterations do not start in a burst: at 10 iterations per second, a new iteration starts roughly every 100 ms. Use maxVUs in the first runs or as a safety margin: growing the VU pool in the middle of a test loads the load generator itself and can distort the results, so it is usually better to allocate the required number of preAllocatedVUs up front.

How the test ends

When a scenario’s time runs out or its iterations are used up, k6 by default gives VUs another 30 seconds (gracefulStop) to finish the current iteration; iterations that do not finish in time are interrupted and counted as interrupted. A 10-second test with a gracefulStop of 3 seconds actually lasts up to 13.

The ramping-vus executor also has gracefulRampDown: when a stage needs fewer VUs than the previous one, k6 stops the extra VUs, and gracefulRampDown gives them time to finish the iteration they have started.

Selecting scenarios with a flag

To run only some of the scenarios in a script without editing it, pass the --scenario flag with the scenario name; list several names separated by commas. The flag appeared in k6 2.3. Each selected scenario keeps its executor, load, timings, function, variables and tags; the --vus and --duration flags cannot be combined with it, so set the load in the scenarios themselves. k6 skips thresholds of excluded scenarios with a warning, and global thresholds stay.

bashon the host
k6 run --scenario checkout test.jsk6 run --scenario browse,checkout test.js

Reads and writes in one test

A typical API profile has an order of magnitude more reads than writes, and they need to be modelled differently. Give the two scenarios different rates using arrival-rate executors, and use exec to send them to different functions.

javascriptreads and writes at the same time
import http from 'k6/http'; export const options = {  scenarios: {    read: {      executor: 'constant-arrival-rate',      rate: 200,      timeUnit: '1s',      duration: '5m',      preAllocatedVUs: 150,      maxVUs: 300,      exec: 'readItems',      tags: { role: 'read' },    },    write: {      executor: 'constant-arrival-rate',      rate: 10,      timeUnit: '1s',      duration: '5m',      preAllocatedVUs: 20,      maxVUs: 50,      exec: 'createItem',      tags: { role: 'write' },    },  },}; export function readItems() {  http.get('https://api.example.com/items/');} export function createItem() {  http.post('https://api.example.com/items/',    JSON.stringify({ title: 'sample' }),    { headers: { 'Content-Type': 'application/json' } });}

Both scenarios run for the whole test at the same time: 200 reads and 10 writes per second. In the results, metrics are separated by the role tag; the combined profile fits into one run instead of two. Arrival-rate executors do not need a sleep at the end of an iteration: the executor sets the pace.

Distributed runs on several machines through k6-operator in Kubernetes use the same scenarios; see the k6-operator documentation for details.

Section sources

the section is written from these pages

k6: scripts and running tests

k6 is Grafana’s load-testing tool: a test is a JavaScript script that you run with a single command from a terminal or Docker. To get started, install k6, save your first script and run it with a few virtual users.

Installation

For Debian and Ubuntu, k6 maintains its own apt repository, and its packages are updated together with k6 releases:

bashon a Debian or Ubuntu host
# k6 repository key and address for aptcurl -fsSL https://dl.k6.io/key.gpg \  | sudo gpg --dearmor -o /usr/share/keyrings/k6-archive-keyring.gpgecho "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] \  https://dl.k6.io/deb stable main" \  | sudo tee /etc/apt/sources.list.d/k6.listsudo apt-get updatesudo apt-get install k6

In Docker the image is called grafana/k6, and the script is passed on stdin. On macOS, install with Homebrew (brew install k6); on Windows, use winget (winget install k6 --source winget) or the official installer. The Chocolatey package is maintained by the community.

bashin Docker, on any system
docker pull grafana/k6docker run --rm -i grafana/k6 run \  - < script.js

Your first script

A script rests on three parts: imports of k6 modules, an options object with the run settings, and a function exported as default, which k6 runs in every iteration. check() verifies the response, and sleep() pauses between iterations like a real user.

javascriptscript.js
import http from 'k6/http';import { check, sleep } from 'k6'; export const options = {  vus: 10,  duration: '30s',}; // runs on every iteration of every VUexport default function () {  const res = http.get('https://example.com/');  check(res, { 'is status 200': (r) => r.status === 200 });  // the pause brings behaviour closer to a real user  sleep(1);}

Run the script: k6 prints progress and, at the end, a summary with the number of iterations, response times and the share of passed checks. For what these metrics mean, see the section “Metrics: latency, percentiles, RPS”.

bashon the host
k6 run \  --vus 10 \  --duration 30s \  script.js

You can keep the same settings in the script’s options: the command line overrides the file, so flags are handy for a one-off run. --vus and --duration are shorthand for a single scenario with the constant-vus executor, and they replace any scenarios written in the script. For stepped load shapes and constant rates, see the section “Scenarios and k6 executors”.

FlagWhat it doesDefault
--vushow many virtual users run1
--durationhow long the test lastsnot set
--iterationshow many iterations run in total1
--env VAR=valuepasses a variable to the scriptnone
--onceone run with one VU, for a smoke testoff

For a quick check of a script, do a single run with one VU: k6 run --once script.js. The flag appeared in k6 2.3 and works for scripts with no scenarios or with one scenario. Unlike --vus 1 --iterations 1, it keeps the scenario’s function and the browser module settings. For the smoke run as a stage before load testing, see the section “Types of load tests”.

Test lifecycle

A test always goes through four stages. Code outside functions is the init stage: it prepares the script and runs first, but cannot make HTTP requests. Load files and modules in init, because VU code cannot do that.

StageHow many timesPurpose
initonce per VUimports, reading files, options
setup()once per testpreparing data and the environment
VU codeevery iterationrequests and checks
teardown()once per testtearing down the environment

setup() returns data, which is passed as an argument to default() and teardown(). Only JSON can be passed, with no functions, and each VU gets its own copy. While debugging, switch the stages off with the --no-setup and --no-teardown flags.

Checks and thresholds

check() tests a condition on a response: status, text in the body, size. A failed check does not stop the test: k6 only counts the share of successful checks in the checks metric. A threshold, by contrast, is a criterion on a metric: if it is not met, the test finishes with a non-zero exit code, and with abortOnFail it stops as soon as the threshold is breached. For failed checks to affect the outcome, add a threshold on checks:

javascriptin the script’s `options`
export const options = {  thresholds: {    // the test fails if fewer than 95% of checks pass    checks: ['rate>0.95'],  },};

Data: files and parameterisation

Keep logins, products and addresses in a file and read them through SharedArray: each VU is a separate JavaScript virtual machine, and without SharedArray k6 would load a copy of the file into each one. The SharedArray function runs once, so parsing and filtering the file is safe only inside it. k6 does not parse CSV itself, so use the Papa Parse library.

javascriptscript.js next to users.json
import { SharedArray } from 'k6/data';import { scenario } from 'k6/execution';import http from 'k6/http'; const users = new SharedArray('users', function () {  // the file is read once for all VUs  return JSON.parse(open('./users.json'));}); export default function () {  // iterations take rows in a cycle  const user = users[scenario.iterationInTest % users.length];  http.post('https://example.com/login', JSON.stringify(user));}

Correlation means extracting a value from one response and substituting it into the next request. This is how you test chains of steps with session tokens. Take the value from the JSON response with res.json() and pass it in the headers of the next request:

javascriptscript.js
import http from 'k6/http'; export default function () {  const login = http.post('https://example.com/api/login');  const token = login.json().token;  http.get('https://example.com/api/profile', {    headers: { Authorization: `Bearer ${token}` },  });}

Browser checks of pages in k6 are done by the separate browser module, and functional browser checks are a separate topic, Playwright. The k6-operator distributes load from many machines in Kubernetes.

k6 v1 scripts need changes when moving to v2: the extension module path changed, deprecated commands were removed, and so was the externally-controlled executor. For the list of changes and migration steps, see the 2.0.0 release notes.

Section sources

the section is written from these pages

Apache JMeter

Apache JMeter is a Java load-testing tool: the test plan is stored in an XML .jmx file, and thread groups generate the load. JMeter runs on Java 8 or later; Java 17 or later is recommended. You need the GUI only to build the plan; run the test itself from the command line.

Install a JDK rather than a JRE: JMeter uses keytool from the JDK to record HTTPS. A plan is built from elements in a single tree: a thread group sets the number of users and the duration, samplers send requests, timers control the pace, and assertions check the responses.

bashon the load generator
jmeter -n -t plan.jmx -l results.jtl -e -o report

-n enables CLI mode, -t sets the plan, and -l sets the .jtl results file. The -e -o flags build an HTML report after the run; the report directory must not exist or must be empty. During the test JMeter prints a short summary to the console at intervals.

What a test plan consists of

A minimal plan is a test, one thread group and one or more samplers, which are the elements that send requests. Add the other elements as the scenario gets more complex:

ElementPurpose
Test Planthe root of the tree; settings for the whole run, such as running thread groups one after another
Thread Groupthe number of threads (virtual users), the ramp-up period over which all threads start, and the duration
Sampler (HTTP Request)one request: method, path, parameters, body
Controller (logic)order and branching: loops, conditions, Once Only Controller for logging in
Config Element (HTTP Request Defaults, CSV Data Set Config)shared request parameters and user data
Timer (Constant Timer)a pause before each request in its scope
Pre/Post Processor (JSON Extractor)an action before and after a sampler: pre-processors prepare the request, post-processors handle the response, for example by extracting values
Assertion (Response Assertion)a response check: without it, only a 4xx or 5xx code counts as an error
Listenerrecording of results; do not use GUI listeners during load

Order and scope

For each pass of a thread, elements run in a fixed order. Timers, pre-processors and post-processors fire only if a sampler is in their scope. Controllers and samplers run in the order they appear in the tree:

textexecution order
Configuration ElementPre-ProcessorTimerSamplerPost-ProcessorAssertionListener

Scope is set by position in the tree: an element applies to all samplers in its branch, and an element of the same type in a nested branch overrides the parent. To limit an element to a single request, add it as a child of that sampler.

A reference plan

A skeleton plan for an API: one request and extraction of a value from a JSON response. The editor builds the full file; only the key fields are shown here:

xmlplan.jmx fragment
<!-- plan.jmx fragment: Test Plan and Thread Group not shown --><HTTPSamplerProxy guiclass="HttpTestSampleGui"    testclass="HTTPSamplerProxy">  <stringProp name="HTTPSampler.path">/api/cart</stringProp>  <stringProp name="HTTPSampler.method">GET</stringProp></HTTPSamplerProxy><JSONPostProcessor guiclass="JSONPostProcessorGui"    testclass="JSONPostProcessor">  <stringProp name="JSONPostProcessor.referenceNames">token</stringProp>  <stringProp name="JSONPostProcessor.jsonPathExprs">$.token</stringProp></JSONPostProcessor>

Variables are local to a thread: once you store a value in the token variable, only that thread and its subsequent requests can use it. Properties are shared by all threads; the __P function reads them with a default value:

xmlplan.jmx fragment
<stringProp name="ThreadGroup.num_threads">${__P(threads,50)}</stringProp><stringProp name="ThreadGroup.ramp_time">${__P(ramp,10)}</stringProp>

The number of threads and the ramp-up are passed as properties instead of editing the plan, so the same .jmx works at any load:

bashon the load generator
jmeter -n -t plan.jmx -l results.jtl \  -Jthreads=100 -Jramp=60

User data

Take logins, passwords and identifiers from a file: CSV Data Set Config reads the next row and spreads its fields across variables. By default the file is shared by all threads (All threads), and each thread takes the next row as it works.

csvusers.csv
username,passwordanna,s3cret-1boris,s3cret-2

Response assertions

Add an assertion (Response Assertion) to every request: the Contains pattern is read as a regular expression, and Substring as exact text. A failed response is counted in the error percentage and in the report; a response without an assertion with a 2xx or 3xx code counts as successful even if the body is an error page.

HTML report after the run

The report builds a statistics table with percentiles and APDEX, the error rate and charts: latency and active threads over time, requests per second, response codes. Build a report separately from an existing results file:

bashon the load generator
jmeter -g results.jtl -o report

Do not use the GUI during load: listeners consume memory and slow down the generator itself. The generator needs memory: by default JMeter runs with a 1 GB Java heap, and with more threads you need a larger heap through the JVM_ARGS variable. If one machine is not enough, run jmeter-server on the generators, and the client lists them with the -R host1,host2 flag.

To learn how to read the numbers in the report (percentiles, throughput, thresholds), see the section “Analysing results and reporting”. For what load a thread group generates and how it differs from the open model, see the section “Load models: open and closed”.

Section sources

the section is written from these pages

Analysing results and reporting

Read the results of a load test in three steps. The k6 summary shows whether the thresholds were met; comparing client metrics with server metrics points to the bottleneck; comparing against a baseline run separates a regression from ordinary variation. The outcome is a report: goals, conditions, results, conclusions, recommendations.

The k6 end-of-test summary

When a test ends, k6 prints a summary to stdout. The default is compact mode: thresholds, checks and metric aggregates by category. full mode adds breakdowns by group and scenario, and disabled turns the summary off; the --summary-mode flag switches between them.

textexample output, compact mode
  █ THRESHOLDS     http_req_duration    ✓ 'p(95)<500' p(95)=348.21ms    ✗ 'p(99)<800' p(99)=912.44ms     http_req_failed    ✓ 'rate<0.01' rate=0.00%   █ TOTAL RESULTS     checks_succeeded...: 99.80%  2495 out of 2500    http_req_duration..: avg=142ms  med=135ms                         p(90)=201ms  p(95)=348ms    http_reqs..........: 2500    41.66/s    vus................: 50      min=50  max=50    data_received......: 18 MB   310 kB/s

Read it from the top. Start with the THRESHOLDS block: a tick means the threshold was met, a cross means it was breached; for a breached threshold, compare the actual value with the target. Next come the checks: the share of failed check calls shows how many responses were “successful but unusable”, such as a 200 status with an error in the body. After that come the metric aggregates: p(90) and p(95) of response time mean that 90% and 95% of requests were faster than these values, followed by the http_reqs rate, the number of virtual users (VUs) and traffic. --summary-trend-stats sets the statistics shown for Trend metrics, and --summary-time-unit fixes the time unit.

In CI the summary is a contract: a zero exit code means the thresholds were met, and a non-zero one means the test failed and the pipeline fails with it. A threshold stops the test early if it sets abortOnFail: true, which saves minutes on long runs; delayAbortEval gives the test time to gather data first.

Where to look besides the summary

The summary is an aggregate over the whole test: it shows the average picture, but not the moment the system began to degrade. The k6 web dashboard draws charts in real time. Enable it with the K6_WEB_DASHBOARD=true variable and open it at localhost:5665; K6_WEB_DASHBOARD_EXPORT sets the HTML report file.

bashdashboard and HTML report, on the host
K6_WEB_DASHBOARD=true \K6_WEB_DASHBOARD_EXPORT=report.html \k6 run script.js

For a longer analysis, export the metrics in full: --out json=results.json writes every measurement with a timestamp to a file, and --out experimental-prometheus-rw streams them to Prometheus, next to the server metrics. You can use both outputs at once by passing two --out flags.

Client metrics and server metrics

Load generator metrics tell you what is happening: whether response time is rising and whether the request rate (requests per second, RPS) is falling. You cannot find out why without server metrics: monitoring collects CPU, memory, disk and database connection queue data, and Grafana dashboards are built on data from Prometheus (see the Prometheus and Grafana reference, section “Grafana dashboards”). Look at both charts, client and server, in the same time window: then a spike in response time lines up with the same second of CPU load.

ISTQB advises correlating metrics to find the point where performance starts to degrade: how many requests per second the system handled when the CPU reached 90% and the system slowed down.

How to find the bottleneck

Look for the bottleneck by comparing three pictures: load rate, response time and server resources. The k6 charts suggest a hypothesis, and the server metrics confirm or refute it.

SymptomLikely causeWhat to do
Response time grows at a constant arrival ratethe system cannot keep up and the input queue is growingfind the moment of degradation and the server metrics for the same second
RPS plateaus while response time growssome resource is saturatedcompare the VU and RPS charts: if VUs keep being added but RPS does not, the bottleneck is not in the generator
One service’s CPU is maxed out while its neighbours are lightly loadedthe bottleneck is in that serviceprofile it; if CPU is low everywhere, suspect locks, the database or the network
Timeouts and dropped connections increasethe system is failing rather than slowing downcheck at what rate the failures began

From there, move on to the service’s profiles and logs: the table suggests where to look, and profiling shows which part of the code is slow. A repeat run after the fix confirms the finding: response time returns to its earlier values.

Comparing with a baseline run

A baseline run is a snapshot of performance at a point in time, against which later runs are compared. Run the same scenario on the same data and configuration and compare p95, RPS and the error rate. If p95 or the error rate is noticeably higher than the baseline, something has changed in the code or the environment.

A single release can speed up some scenarios and slow down others: a bottleneck that has been removed shifts to another part of the system. So compare all the agreed metrics and scenarios, not a single number.

The comparison needs identical conditions: record the configuration and any changes between runs, otherwise the difference is environment noise, not a regression.

The test report

A report is written for stakeholders: the architect, the manager, the product owner. ISTQB describes a typical load testing report:

  • Executive summary: conclusions and recommendations on one page
  • Goals and criteria: what was tested and which thresholds were adopted as success criteria
  • Conditions: scenario, load rate, date, environment configuration and its changes between runs
  • Results: response time percentiles, RPS, error rate, server resource load, charts of the test run
  • Conclusions: where the system’s limit is, which bottleneck was found, whether the criteria were met
  • Recommendations: configuration and code changes, areas for further analysis, what else to monitor

Section sources

the section is written from these pages

Common mistakes in approach

A mistake in the approach to load testing does not break the script; it gives you good numbers for a broken system or bad ones for a healthy system. The main sources of wrong results are a load generator short of resources, runs without goals and thresholds, averages instead of percentiles, and unrealistic scenarios.

MistakeRiskWhat to do
A single generator machine with no monitoringthe generator itself becomes the bottleneckwatch the machine’s CPU, memory and network
A run without goals and thresholdsyou have numbers but no conclusionwrite the thresholds into the script before the run
Looking only at averagesslow requests stay invisiblestate goals in terms of percentiles
A closed model for measuring the limitload drops as the system degradesan open model and monitoring of dropped iterations
A scenario with no pauses and a single data setthe result is better or worse than productionthink time and varied data
A run on production without agreementreal users and data are at riskagree it and accept the risks in advance

The generator became the bottleneck

A load generator is also a program, and it uses its own CPU, memory and network. A single k6 machine can create 30,000–40,000 virtual users and up to 300,000 requests per second, but only while it has enough resources. If the generator’s CPU is 100% busy, the response time in the report rises on its own, and the system under test is not the cause.

The k6 documentation sets three limits: machine CPU no higher than 80%, memory no higher than 90%, and the network as the test plan requires. Simple tests use 1–5 MB per virtual user; file uploads and large JS modules use tens of megabytes. Estimate the amount with a trial run at 100 VUs and multiply by the target number. A shortage of open files shows up as the too many open files error, so check the limit before the run.

bashon the generator machine
# generator resources during the runhtop# network: is the bandwidth saturatediftop

A run without goals and thresholds

A “let’s run it and see” test ends with a set of charts and no conclusion. State the goal before the run: will the release survive the peak hour, will the system degrade over a shift, where is the capacity limit. Write the success criteria into the script as thresholds, so the run itself says whether it passed. How goals are derived from risks is covered in the section “Checklist”.

javascriptthresholds instead of “let’s see”
export const options = {  thresholds: {    http_req_duration: ['p(95)<800'],    http_req_failed: ['rate<0.01'],  },};

Averages only

The average response time hides the tail: rare slow requests barely affect it, yet they are exactly what the user notices. State your targets in terms of percentiles: p95 and p99. The metrics and a worked example are in the section “Metrics: latency, percentiles, RPS”.

A closed model where an open one is needed

In a closed model, a new iteration starts only after the previous one gets a response. When the system slows down, iterations get longer and there are fewer new requests, so the load drops at exactly the moment you are testing. In the literature this effect is called coordinated omission; the JMeter manual names it as a source of wrong results when the number of threads is poorly chosen.

If the goal is a given request rate, you need an open model: constant-arrival-rate holds the rate regardless of responses. It reports a shortage of free VUs with the dropped_iterations metric: the iteration was not sent, and this is not an HTTP error. The causes range from scenario settings to system degradation: mass drops in the middle of a run are a bad sign, and any acceptable level is best fixed with a threshold. Choosing a model is covered in the section “Workload models: open and closed”.

Unrealistic scenarios

A user reads a page, fills in a form and pauses; a script with no pauses produces a flow that never occurs in reality. Set think time with sleep() between requests: it spreads requests out in time and lowers the load from a single VU. Together with the number of VUs, the pause defines the real profile.

Identical data for all virtual users skews the result in both directions. A cache serves records from memory, so the numbers look better than production; locks on the same rows, on the contrary, build a queue, so the numbers look worse. The ISTQB CT-PT syllabus also gives the opposite case: an unparameterised order name breaks the second pass because the name already exists.

A warm cache on the test environment is another gap with production. Run after run responds faster, not because the system has improved, but because the data is already in memory. The basis for warm-up is either an equally cold start before every run or an equally long ramp-up to the plateau, with comparable conditions stated in the report.

A production test without agreement

Sometimes production is the only environment where a test makes sense: the test environment does not reproduce the configuration, the data volume and the external services. In that case discuss and accept the risks to real users in advance, not after an incident. ISTQB CT-PT requires agreeing mitigation measures before the test is run; also warn the owners of the environment, since a shared environment may have been booked for another run.

A run that is too short

A memory leak is not visible in a five-minute run: degradation builds up over hours. Endurance testing checks exactly this: exhaustion of memory, connections and thread pools over a long time. A standard run also needs time: ramp-up, a plateau for measurements, ramp-down. Durations for each kind of test are in the section “Types of load tests”.

Errors in responses are ignored

A run at the edge of failure looks successful if you do not look at the errors: a 503 status does not cancel out fast responses. A check that refers to the response body fails on its own when the system fails, because the body may not exist and the check throws a TypeError. The scenario broke before the system did.

javascripta check that survives failure
import { check } from 'k6';import http from 'k6/http'; export default function () {  const res = http.get('https://test.k6.io/');  check(res, {    'homepage body size is 11026 bytes': (r) =>      r.body && r.body.length === 11026,  });}

Record the error rate in the thresholds together with response time. At large scale, isolated errors are always present: the k6 documentation counts 100 failed requests out of 50 million as a good result. The point is not zero errors, but an agreed acceptable level.

Section sources

the section is written from these pages

Versions and what’s new

This reference covers Grafana k6 2.3 (release 2.3.0 of 21 September 2026) and Apache JMeter 5.6, with 5.6.3 of 9 January 2024 as the current release. Major versions of k6 come out once a year and minor ones every six weeks: 2.1 in June, 2.2 in August and 2.3 in September 2026.

Tool and branchStatusFirst releaseLatest release
k6 2.3current, receiving releases2.3.0 — 21 September 20262.3.0 — 21 September 2026
k6 1.8supported: bug and security fixes1.8.0 — 8 June 20261.8.2 — 12 October 2026
JMeter 5.6current, receiving releases5.6 — 24 June 20235.6.3 — 9 January 2024

k6 follows Semantic Versioning: a major release means breaking changes, a minor one means new features without breakage, and a patch means bug fixes. The previous major branch receives only bug and security fixes and no new features, and the one before it is declared deprecated.

The next major release of JMeter will require Java 17 or later, so build your plans and CI on that Java version now.

What changed in k6 2.3

A minor release introduces no breaking changes. The main points of 2.3:

  • k6 scenarios and executors: the --scenario flag runs some of a script’s scenarios by name without editing the script: k6 run --scenario homepage script.js. Names are separated by commas; each selected scenario keeps its executor, load, timing, function, environment variables, tags and browser module settings.
  • k6 scenarios and executors: the --once flag is the recommended way to do a smoke run: it turns a single scenario into one run with one virtual user and keeps its function and browser module settings, instead of replacing them with a default scenario.
  • k6 scripts and running: an async function in group() is experimental, enabled with the --features async-metric-context flag. Requests and checks after await stay in their own group, and group_duration measures up to promise completion; tags are also no longer lost in timers and listeners of k6/websockets and gRPC.
  • k6 scripts and running: the tlsAIAFetch: true option fetches a missing intermediate CA certificate for servers that work in a browser but fail verification in k6. The option is enabled manually and works for HTTP and gRPC.
  • Built-in JavaScript methods: Uint8Array.fromHex() and toBase64() for binary data, the set operations difference(), intersection() and union(), and JSON.rawJSON() for an exact large number in JSON without rounding.
  • Analysing results and reporting: K6_PROMETHEUS_RW_LABELS labels distinguish several generators in the Prometheus remote write output.
  • Analysing results and reporting: --log-ns-timestamps log timestamps with nanosecond precision keep their order within a single second and are easier to match across log streams.

Deprecated and removed

The major release k6 2.0 of 11 May 2026 finished the clean-up: the Go module path for extensions changed to go.k6.io/k6/v2, and the deprecated commands k6 login, k6 pause, k6 resume, k6 scale and k6 status, the flags --no-summary and --upload-only, and the externally-controlled executor were removed. Scenarios that use it no longer run, so move to executors with a defined load profile. The options.ext.loadimpact block is not supported: cloud settings move to options.cloud, and the k6/experimental/redis import is replaced by k6/x/redis, with the extension picked up automatically.

Security updates

The Security updates section of the k6 release notes is where updates to dependencies and to k6 itself are published. Patch 1.8.2 of 12 October 2026 updates gRPC, golang.org/x/net, golang.org/x/crypto, OpenTelemetry and the Go toolchain; 1.8.1 has the same set plus golang.org/x/text and klauspost/compress. The release notes for 2.3.0 list no such updates.

How to upgrade

Patches and minor releases are compatible within a major version: upgrade the same way you installed k6. On Debian and Ubuntu use sudo apt-get update && sudo apt-get install k6, and with Homebrew use brew upgrade k6. In CI, pin a specific release rather than the latest tag.

bashon a Debian or Ubuntu host
sudo apt-get update && sudo apt-get install k6
bashchecking the version after the upgrade
k6 version

The k6 stability policy covers public options, the CLI, the JavaScript interpreter, core modules such as k6 and k6/http, the extension API, metric names and types, and built-in outputs. The experimental k6/experimental modules and the REST API are not on the list and may change.

Section sources

the section is written from these pages

End of the reference

What changed

revision history · 4 entries

Every edit is saved as a revision: a snapshot of the reference, the reason and a summary of changes. The published version changes only after the same checks as at creation.

  1. Manual edit

    reason: manual edit
  2. Manual edit

    reason: manual edit
  3. Manual edit

    reason: manual edit
  4. Reference updated

Weekly check

How the reference is checked

Once a week — and right after news of a release or a vulnerability — the reference is checked in three steps.

  1. 1. Freshness

    Sections are compared with the release notes and changelogs from the official sources and with the topic’s news.

  2. 2. Errors

    Every section is read again: wrong facts, outdated APIs and flags, broken examples.

  3. 3. Links — by an HTTP request

    Every source link must respond. A broken link is a reason to recheck the section.

No findings — only the date changes. Findings — only the affected sections are rewritten, and they appear in “What changed”. A new version replaces the published one only after passing the same checks as at creation.

Statuses

Verified
no findings
Updated
sections rewritten, edits are listed
Rechecking
while the check runs, the previous version stays open
Needs review
disputed points: the verified version is shown, editors review

Last check

18 Nov · Check · updated · no findings

Found an error in the reference?

On the topic

tracks, news and other references
The whole “Load testing” topic
12 sections
Another reference · Testing (QA)

Test design

Verified 1 Nov
All references · 61