skip to content

Grafana k6

3 roadmaps161 questionsupdated

The scriptable load tester where scenarios are JavaScript and pass/fail is expressed as thresholds on metrics. Asked because it fits load testing into CI, which is where interviewers want performance checks to live.

on this pageshow

guide

overview

~1 min

k6 is a load-testing tool from Grafana Labs in which each test is an ES module written in JavaScript and the verdict is a set of thresholds over the metrics the run collects. Interviewers bring it up when a performance conversation reaches delivery: how a load test runs unattended in a pipeline, what makes it fail a build, and how a script describes the traffic it should generate. A strong k6 answer keeps three things apart that newcomers blur — the load a scenario produces, the numbers the run records, and the rule that turns those numbers into pass or fail. The hub follows that split. [Script anatomy](/topics/dev-k6-script) is the base: the regions of a test file and how often each one runs. [Declared settings](/topics/dev-k6-options) and [executor choice](/topics/dev-k6-executors) describe the workload — where a setting comes from, and whether load is bounded by users or by an arrival rate. The [metric model](/topics/dev-k6-metrics) says what each number is, and [verdict gating](/topics/dev-k6-verdict) how checks and thresholds become an exit status. [Transport surface](/topics/dev-k6-protocols) covers which protocols a script can drive, [runtime and extension](/topics/dev-k6-runtime) the embedded JavaScript engine and its limits, [measurement delivery](/topics/dev-k6-output) the end-of-test report and the live streams, and [automation fit](/topics/dev-k6-pipeline) how runs land in CI, split across machines, and compare with other load generators. Junior rounds ask where a line of code belongs, what an executor key means, and why a failing check can leave the build green. Senior rounds turn to modelling: open against closed load, what a percentile hides, what breaks when one test is split across instances, and why a team should trust a verdict nobody watched. Learn the script's regions first, then options and executors, then metrics and thresholds. Protocols, outputs and distributed runs all build on those.

primer

### A test is code, run by many copies A k6 script is an ES module, and k6 runs a separate copy of it for every virtual user, each in its own JavaScript runtime. That one fact explains most placement questions: module-scope code runs per VU while it initializes, `setup()` and `teardown()` run once for the whole test, and the default function is the loop body each VU repeats. Put a call in the wrong region and it either throws or multiplies its memory by the VU count. ### The executor decides what load means Every run is a map of scenarios, and each scenario names an executor. VU-based executors fix how many users exist and let throughput fall out of response time — a **closed model**, where a slowing system receives less traffic. Arrival-rate executors fix how often iterations start and add VUs to keep pace — an **open model**, closer to independent users who do not wait for one another. The choice is a claim about the system under test, and interviewers expect you to defend it. ### Checks observe, thresholds decide A `check()` records whether a condition held and moves on; it neither stops the iteration nor fails the run. Thresholds are declared criteria over a metric's aggregate, and a breached one is what turns the process exit code into a failure. Treating the two as interchangeable is the usual reason a "failing" load test leaves CI green. ### Every number has a type Metrics come in four types (Counter, Gauge, Rate, Trend), and the type decides which aggregations exist, so it decides which thresholds are valid at all. Built-in metrics have precise boundaries too: knowing what a request duration includes and excludes is the difference between reading a result and guessing at it. Tags and groups slice the same samples by dimension. ### Configuration is layered The exported `options` object is the configuration, but a config file, environment variables and CLI flags can override it, and some keys are replaced as a set. Knowing which layer wins, and what an override quietly discards, is most of debugging a run that did something other than what the script says. ### JavaScript, but not Node k6 embeds its own Go-hosted JavaScript engine. Node's built-in modules and npm resolution are both absent, imports need exact paths, and a new protocol arrives as a compiled extension rather than a package. Questions here probe whether you know where that boundary lies before you hit it.

Virtual user (VU)
An independent runner of the script with its own JavaScript runtime and state. k6 generates load by running many of them concurrently.
Iteration
One complete pass by one VU through the function a scenario executes. Executors schedule and count work in iterations.
Init context
The module-scope code each VU evaluates before its first iteration: imports, options, file loading and metric declarations. Calls that need a running VU are refused there.
Scenario
A named entry in options.scenarios that pairs one executor with its settings, the function to run, and its own tags and start timing.
Executor
The scheduler inside a scenario that decides how many VUs run and when iterations start. k6 has six, split between VU-bound and arrival-rate models.
Closed model
Load defined by a fixed number of concurrent users, each starting its next iteration only after the previous one ends, so throughput falls as responses slow.
Open model
Load defined by how often new iterations start, independent of how fast earlier ones finish. k6's arrival-rate executors implement it.
Check
A named boolean assertion whose result is recorded on the built-in checks metric. It reports what happened but cannot fail a run by itself.
Threshold
A pass or fail criterion on a metric's aggregate, declared in options. Any breached threshold gives the run a non-zero exit code.
Trend
The metric type that keeps every sample, so it can report averages, medians and percentiles. Every built-in duration metric is a Trend.
Rate
The metric type that reports the share of non-zero samples, such as the fraction of checks passed or requests failed, as a value between 0 and 1.
Tag
A key-value label carried by metric samples, used to filter thresholds and outputs by request, scenario or any custom dimension.
SharedArray
A read-only data container from k6/data that keeps one copy of a data set per k6 process instead of one per VU.
handleSummary
An optional exported function that receives the end-of-test data and decides which reports are written and where, in place of the default summary.
Output
A destination k6 streams metric samples to while the run is in progress, chosen with --out: a file, a time-series database or a telemetry endpoint.
Execution segment
A slice of a test's total work assigned to one k6 instance, so several processes can share one plan without overlapping.
Extension
Go code compiled into a custom k6 binary to add protocols, outputs or APIs that core k6 lacks.

Follow one run from command to exit code. k6 first evaluates the script to read its options, merges them with the other configuration layers, and builds the scenarios map, deriving a single default scenario when only shortcut keys are set. It then initializes VUs, each evaluating the module scope in a private runtime, calls `setup()` once, and hands each executor its scenario. Executors start iterations on their schedule; every request, check and custom metric inside an iteration emits tagged samples. Those samples feed the aggregates that thresholds read and are streamed, at the same time, to any configured outputs. When the scenarios finish and `teardown()` has run, thresholds get their final evaluation, the summary or `handleSummary()` report is produced, and the process exits with a code that says whether every threshold held. The hub's sections hang off that path: - **Script anatomy** and **declared settings** are the input: what the file contains and what the run is told to do. - **Executor choice** is the scheduler between configuration and iterations. - **Transport surface** and **runtime and extension** live inside the iteration: which clients exist and what the JavaScript can do. - **Metric model** names the samples, **measurement delivery** is where they go, and **verdict gating** is what is decided from them. - **Automation fit** wraps the whole run in a pipeline step, or splits it across machines. ```javascript // imports of http (k6/http) and check (k6) omitted export const options = { scenarios: { browse: { executor: 'constant-arrival-rate', rate: 50, timeUnit: '1s', duration: '2m', preAllocatedVUs: 20, maxVUs: 100 }, }, thresholds: { http_req_duration: ['p(95)<400'], checks: ['rate>0.99'], }, }; export default function () { const res = http.get(`${__ENV.BASE_URL}/catalog`); check(res, { 'status is 200': (r) => r.status === 200 }); } ``` Three ideas meet here. The scenario fixes an arrival rate, so a slowing service shows up as rising latency and dropped iterations rather than as less traffic. The check records each response, but only the two thresholds can fail the build — delete the `checks` entry and the check becomes decoration.

  1. Script Anatomy →

    The regions of a test file and how often each runs; every other section assumes you know where a line of code belongs.

  2. Declared Settings →

    The options object, the layers that override it, and the scenarios map that names each workload.

  3. Executor Choice →

    How a scenario schedules iterations: bounded by users or by arrival rate, and what each executor's keys set.

  4. Metric Model →

    The four metric types and what the built-in metrics measure, which you need before writing any threshold.

  5. Verdict Gating →

    How checks and thresholds turn metrics into a pass or fail, the split interviewers probe most.

  6. Automation Fit →

    Running k6 headless in CI and containers, splitting a test across instances, and where k6 sits among load generators.

  • Expecting a false check() to fail the run or stop the iteration: it only records a result; a breached threshold, not a failed check, is what sets the failing exit code.

  • Writing a Rate threshold as a percentage, such as rate>95; a rate is a fraction between 0 and 1, so that criterion can never be met.

  • Picking a VU-based executor to test a throughput target: under a closed model a slowing system receives less load, hiding the saturation the test was meant to find.

  • Loading a large data file at module scope without SharedArray; each VU then holds its own copy, and memory grows with the VU count.

  • Assuming npm packages or Node built-ins will import: k6 is not Node, and relative imports need the full file name, extension included.

  • Passing --duration on the command line and expecting the script's scenarios to survive; see Declared settings for which keys replace each other.

  • Reporting the average response time as the result: a Trend's percentiles describe the tail users feel, and the average hides it.

  • Splitting a test with execution segments and reading one instance's thresholds as the verdict; core k6 does not merge results across processes.

  • Copying a k6/experimental/... import from older material for a module that has since graduated; in k6 v2 such imports abort the run at load time.

This guide assumes k6 v2. The changes interviewers still ask about are mostly about module paths, because tutorials and scripts written for earlier releases are everywhere and fail in a specific way: - **Graduated modules.** The browser module now lives at `k6/browser` with an async, awaited API, and the gRPC client at `k6/net/grpc`. Their old `k6/experimental/...` paths survive only as stubs that fail with a pointer to the new location, so an outdated script fails while loading rather than misbehaving later. - **A smaller experimental namespace.** What remains under `k6/experimental/` is a short list of modules deliberately outside the stability guarantee; anything else you find there in old material has moved. - **The engine.** k6 runs on Sobek, a Go JavaScript engine; older material names goja, the engine Sobek was forked from. - **Extensions.** Adding one used to mean building a custom binary yourself with xk6; current releases can also provision a binary with the needed extensions for you. ```javascript // before: experimental path, now throws on import import { browser } from 'k6/experimental/browser'; // k6 v2 import { browser } from 'k6/browser'; ``` When an answer depends on version — an import path, the browser API style, which outputs are still experimental — say which release you are describing.

Interviewers expect you to place k6 among the other load generators. Apache JMeter is the older, GUI-centred option, with test plans stored as XML and a large plugin catalogue. Gatling describes tests in a code DSL on the JVM, Locust in Python, and Artillery in YAML with JavaScript hooks. The distinctions that matter in a k6 answer: tests are JavaScript modules reviewed and diffed like application code, pass or fail is declared in the script as thresholds, and a single Go binary generates load efficiently — at the cost of a runtime that is not Node and cannot use npm packages directly. Around the core sit the pieces you will be asked to wire together. Results stream to time-series stores such as InfluxDB or Prometheus, or to an OpenTelemetry endpoint, and are usually read in Grafana dashboards. Grafana Cloud k6 runs tests on managed load generators and aggregates distributed runs, which core k6 alone does not do; on Kubernetes, the k6 Operator spreads one test across pods. [Peer comparison](/topics/dev-k6-pipeline-positioning) covers the trade-offs in depth.

explore

report an issue with this guide →

questions

161 · 9 sections

In k6, what happens to the running iteration when a check() condition evaluates to false?

level: juniorimportance: must knowfreq 74%
basics
~10 s

Nothing halts. k6 records the failure on its built-in checks metric, check() returns false, and the iteration carries straight on to the next statement. The run's exit status is unaffected.

open as a page

In k6, how do you call check() from the k6 module, and what does each argument do?

level: juniorimportance: must knowfreq 78%
basics
~20 s

k6's check(), from the k6 module, has the signature check(val, sets, [tags]): a value, an object whose keys are check names and whose values are conditions called with that value, and optional extra tags. It returns a boolean.

open as a page

In k6, what exit code does a run return when one of its thresholds is breached?

level: juniorimportance: must knowfreq 72%
basics
~20 s

k6 exits with code 99 when at least one threshold is breached, and 0 when they all hold. That single integer is the whole machine-readable verdict a CI job reads; the printed summary is for humans.

open as a page

In k6, why can a threshold of `checks: ['rate>90']` never pass, however many checks succeed?

level: juniorimportance: must knowfreq 72%
basics
~20 s

k6's built-in checks metric is a Rate, and the only aggregation a Rate threshold accepts is rate, which is a fraction from 0.00 to 1.00 rather than a percentage. So rate>90 is unreachable; write rate>0.9.

open as a page

In k6, what does a threshold key like http_req_duration{status:200} do that a plain metric name does not?

level: juniorimportance: must knowfreq 62%
basics
~10 s

The braces create a sub-metric: k6 registers a filtered copy of http_req_duration that receives only the samples whose tags contain status:200, and evaluates the threshold against that copy instead of the whole metric.

open as a page

In a k6 `constant-arrival-rate` scenario, what do the `rate`, `timeUnit` and `duration` keys each set?

level: juniorimportance: must knowfreq 74%
basics
~10 s

In k6 v2, rate is how many iterations the executor starts during each timeUnit period, timeUnit is that period (default 1s), and duration is how long the scenario keeps starting them.

open as a page

Which k6 scenario do the root vus and iterations options build, and what does duration do there?

level: juniorimportance: must knowfreq 68%
basics
~20 s

k6 turns root vus and iterations into a single scenario named default that uses the shared-iterations executor, so iterations is the total across all VUs. A root duration set alongside them becomes that scenario's maxDuration.

open as a page

In k6, how do the constant-vus and ramping-vus executors differ, and what options does each take?

level: juniorimportance: must knowfreq 82%
basics
~20 s

k6's constant-vus executor holds a fixed number of VUs for a set time and takes vus plus duration. ramping-vus moves the count through a schedule and takes startVUs, stages and gracefulRampDown. Neither accepts the other's keys.

open as a page

In a k6 arrival-rate scenario, what do preAllocatedVUs and maxVUs control, and what happens when maxVUs is omitted?

level: juniorimportance: must knowfreq 74%
basics
~10 s

preAllocatedVUs is the number of VUs k6 initializes before an arrival-rate scenario starts; maxVUs is the hard ceiling that pool may grow to mid-run. Omitted, maxVUs equals preAllocatedVUs, so the pool never grows.

open as a page

Which keys does k6's `ramping-arrival-rate` executor take, and what does a stage `target` mean?

level: middleimportance: must knowfreq 66%
basics
~20 s

k6 v2's ramping-arrival-rate takes startRate, timeUnit and stages. Each stage is a target plus a duration, and the target is the arrival rate in iterations started per timeUnit that k6 ramps to linearly by the stage's end.

open as a page

In a k6 script, what does the default exported function do, and what counts as one iteration?

level: juniorimportance: must knowfreq 84%
basics
~20 s

k6's default exported function is the VU code: one virtual user runs it from its first line to its last, and that single start-to-finish call is one iteration. When it returns, the VU calls it again.

open as a page

In a k6 script, which code runs in the init context, and how often does it run?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Everything outside a k6 lifecycle function is init code: imports, the exported options object, open() calls, metric constructors. k6 runs it once per virtual user, in that VU's own JavaScript runtime, before that VU's first iteration.

open as a page

In a k6 script, when does setup() run and how does its return value reach the other stages?

level: juniorimportance: must knowfreq 78%
basics
~20 s

k6 calls setup() once per test run, after the init stage and before any virtual user starts. Whatever it returns is JSON-encoded once and handed to the default function and to teardown() as their first argument.

open as a page

What does k6's SharedArray from k6/data change about how a data file is held in memory?

level: juniorimportance: must knowfreq 76%
basics
~20 s

k6's SharedArray holds one copy of a data set per k6 process, not one per VU. Its loader runs once, k6 stores each element as a JSON string, and a VU gets a copy only on index access.

open as a page

Which k6 calls throw when placed in a script's init context, and what do they all have in common?

level: middleimportance: must knowfreq 66%
basics
~10 s

Anything needing VU state throws in k6's init context: http requests and batch, new http.CookieJar(), check(), group(), a custom metric's .add(), and exec.vu, exec.instance or exec.test.options. k6 attaches VU state only after init finishes.

open as a page

In k6, what is the exported `options` object and how does it configure a test run?

level: juniorimportance: must knowfreq 82%
basics
~20 s

k6 has no separate configuration file format. A k6 script exports an object named options, k6 reads it once at init, and its root keys - vus, duration, stages, scenarios, thresholds, tags - become the run configuration.

open as a page

In a k6 script, what do the keys of the `options.scenarios` object mean, and what must each entry declare?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Every key in k6's options.scenarios object is that scenario's name, unique within the script and limited to letters, digits, underscores and dashes. Each entry must declare executor; exec, startTime, gracefulStop, env and tags all have defaults.

open as a page

In k6, which five layers can set the same option, and in what order do they override each other?

level: middleimportance: must knowfreq 70%
basics
~10 s

k6 resolves each option through five layers, lowest to highest: built-in defaults, a JSON config file, the script's exported options, a K6_ environment variable, then the command-line flag. The CLI flag always wins.

open as a page

In k6, why does adding --duration on the command line discard a whole scenarios map the script declared?

level: seniorimportance: must knowfreq 58%
basics
~10 s

Because duration, iterations, stages and scenarios form one execution group in k6: any of the four set in a higher layer clears all four from every lower layer before the new value is applied.

open as a page

In a k6 scenarios map, what is `startTime` measured from, and how do you make two scenarios run back to back?

level: seniorimportance: must knowfreq 64%
basics
~20 s

startTime is an absolute offset from the start of the k6 run, not from the previous scenario's end. k6 launches every scenario at once and each waits out its own offset, so sequencing is arithmetic you do yourself.

open as a page

Which of k6's four metric types does each built-in such as vus, http_reqs or checks use?

level: juniorimportance: must knowfreq 66%
basics
~20 s

k6 has four metric types: Counter, Gauge, Rate and Trend. Among the built-ins, vus and vus_max are Gauges, http_reqs and iterations are Counters, checks and http_req_failed are Rates, and every duration such as http_req_duration is a Trend.

open as a page

Which four metric classes does k6's k6/metrics module export, and what does each keep?

level: juniorimportance: must knowfreq 76%
basics
~20 s

k6/metrics exports Counter, Gauge, Rate and Trend. Counter sums added values and reports count and rate; Gauge keeps the last value; Rate reports the share of non-zero values; Trend keeps every value, giving avg, min, max, med and p(N).

open as a page

In k6, what does wrapping requests in group('name', callback) add to the metrics they emit?

level: juniorimportance: must knowfreq 70%
basics
~10 s

k6 tags every sample emitted inside the callback with a group tag holding the full nested group path joined by ::, and it emits one group_duration Trend sample timing the callback.

open as a page

In k6, which three metrics add up to http_req_duration, and what does it leave out?

level: middleimportance: must knowfreq 74%
basics
~10 s

http_req_duration equals http_req_sending plus http_req_waiting plus http_req_receiving. It excludes http_req_blocked, http_req_connecting and http_req_tls_handshaking, so connection setup never appears in it.

open as a page

In k6, what happens if you construct a k6/metrics Trend inside the default function instead of at module scope?

level: middleimportance: must knowfreq 64%
basics
~10 s

Constructing a k6 custom metric outside the init context throws "metrics must be declared in the init context". Only .add() may run inside an iteration; the k6/metrics constructors must sit at module scope.

open as a page

In k6 v2, what happens to a script that imports k6/experimental/browser, and what replaces it?

level: juniorimportance: must knowfreq 62%
basics
~10 s

The import throws straight away with a migration message: in k6 v2 the browser module has graduated and k6/experimental/browser was removed. Import browser from k6/browser instead, and await its calls.

open as a page

In k6 v2, which module provides the gRPC client, and what happens if a script imports k6/experimental/grpc?

level: juniorimportance: must knowfreq 58%
basics
~20 s

k6 v2 ships its gRPC client at the stable path k6/net/grpc. The old k6/experimental/grpc name is registered only to throw a migration error on import, so the run aborts in the init phase before any VU starts.

open as a page

In k6, how do you send a JSON body with http.post(), and what does a plain object send instead?

level: juniorimportance: must knowfreq 76%
basics
~10 s

k6 picks the encoding from the body's JavaScript type: a plain object is form-encoded as application/x-www-form-urlencoded. For JSON, pass JSON.stringify(payload) as the body and set Content-Type in the params headers object.

open as a page

In k6, which scenario option enables a real browser, and where in the options object does it go?

level: middleimportance: must knowfreq 58%
basics
~10 s

Set type to 'chromium' in a scenario's own options.browser block, so the full path is options.scenarios.<name>.options.browser.type. It is per-scenario, there is no root-level browser option, and 'chromium' is the only value k6 v2 accepts.

open as a page

Which k6/net/grpc Client calls must run in the init context, and which are rejected there?

level: middleimportance: must knowfreq 62%
basics
~20 s

client.load() and client.loadProtoset() are init-only and error elsewhere with "load must be called in the init context". client.connect(), invoke(), asyncInvoke() and close() are the reverse: they raise an init-context error and must run inside an iteration.

open as a page

In k6, what must an exported `handleSummary(data)` function return, and where does each entry go?

level: juniorimportance: must knowfreq 72%
basics
~20 s

An object whose keys are destinations and whose values are strings or ArrayBuffers. k6 sends the key stdout to standard output, stderr to standard error, and treats every other key as a file path it creates or overwrites.

open as a page

In k6, how do you choose where a run streams its metrics, and which `--out` targets does v2 accept?

level: middleimportance: must knowfreq 58%
basics
~20 s

k6 picks streaming destinations with the repeatable -o/--out flag or the K6_OUT environment variable. k6 v2 accepts json, csv, cloud, influxdb, experimental-prometheus-rw, opentelemetry, experimental-opentelemetry and web-dashboard; any other name aborts the run before it starts.

open as a page

Which statistics can k6's summaryTrendStats option list, and what does it print by default?

level: middleimportance: must knowfreq 58%
basics
~10 s

k6's summaryTrendStats accepts avg, min, med, max, count and p(N) for N between 0 and 100. It defaults to avg, min, med, max, p(90), p(95), and any list you set replaces that default entirely.

open as a page

What does k6's `--out json=` write to its file, and how does `--out csv=` differ?

level: juniorimportance: should knowfreq 50%
basics
~20 s

k6's json target writes newline-delimited objects: a Metric declaration, then a Point per sample with time, value and tags. The csv target writes a fixed header of metric_name, timestamp and metric_value, then tag columns. Both gzip on a .gz path.

open as a page

What does k6's summaryTimeUnit option change in the end-of-test summary?

level: juniorimportance: should knowfreq 40%
basics
~20 s

k6's summaryTimeUnit fixes the unit every duration is printed in throughout the end-of-test summary. It accepts only s, ms or us; left unset, k6 picks a readable unit per value instead, so columns may mix ns, us, ms and s.

open as a page

Why does a k6 script's import of './helpers' fail when './helpers.js' works?

level: juniorimportance: must knowfreq 72%
basics
~20 s

k6 resolves import specifiers the way a browser does, not the way Node does: it never appends .js, never falls back to index.js and never searches node_modules. The extension-less path names a file that does not exist, so the load fails.

open as a page

Why does importing k6/experimental/browser abort a k6 v2 run, and what replaces it?

level: juniorimportance: must knowfreq 71%
basics
~20 s

The browser module graduated to k6/browser, and k6 v2 keeps the old path registered only as a stub that throws a migration message. The run dies while the script is loading and k6 exits 107.

open as a page

Why does adding a new protocol to k6 require a compiled custom binary rather than a plugin file?

level: middleimportance: must knowfreq 72%
basics
~10 s

k6 extensions are Go code compiled into the k6 binary; k6 has no runtime plugin loader. Either k6 provisions a prebuilt binary for you automatically, or you build one yourself with xk6 build --with.

open as a page

Why does a k6 test script that imports Node's fs module fail before any VU runs?

level: middleimportance: must knowfreq 72%
basics
~20 s

k6 executes JavaScript on Sobek, a JavaScript engine written in Go, not on Node.js. It ships no Node standard library and no node_modules resolution, so a bare specifier like fs never resolves and loading the script fails during init.

open as a page

How does k6's own require() differ from an ES import statement in a test script?

level: middleimportance: must knowfreq 51%
basics
~20 s

k6 accepts both, but require() is k6's own implementation, not Node's: it loads built-in k6 modules, local files and remote https scripts only, it exists solely in the init stage, and it takes a specifier computed at runtime.

open as a page

Why does running the grafana/k6 image look like `docker run -i grafana/k6 run - < script.js`?

level: juniorimportance: must knowfreq 62%
basics
~20 s

The grafana/k6 image sets ENTRYPOINT ["k6"], so appended arguments start at a k6 subcommand - here, run. The script lives on the host and not in the image, so the filename - makes k6 read it from standard input.

open as a page

What do k6's --execution-segment and --execution-segment-sequence flags do, and why pass both?

level: middleimportance: must knowfreq 68%
basics
~20 s

In k6, --execution-segment names the slice of total work one process runs, and --execution-segment-sequence names the full partition every process shares. Pass both, or each instance invents its own partition and the slices stop lining up.

open as a page

A script piped into grafana/k6 with `run -` fails on a relative import - why, and what fixes it?

level: middleimportance: must knowfreq 54%
basics
~20 s

Piping delivers one file and nothing else. k6 records a stdin script as /-, so relative imports resolve against the container's working directory, not the script's folder. Mount the directory and pass an in-container path instead.

open as a page

For a JS-fluent team, what does k6's script-as-a-JavaScript-module model make easy, and what does it cost?

level: middleimportance: must knowfreq 62%
basics
~20 s

A k6 test is a JavaScript module: imports, an exported options object, a default function. It reviews, diffs and merges like application code. The cost is that authoring and review require JavaScript, and the runtime is not Node.

open as a page

After four k6 instances each run one execution segment, what does core k6 not do for you?

level: seniorimportance: must knowfreq 62%
basics
~10 s

Core k6 divides the plan but never rejoins the results. There is no primary process, each instance evaluates its thresholds against only its own samples, and each writes its own output stream and summary.

open as a page