k6 Interview Prep: 3-Week Plan and 36 Q&As (2027)

A three-week k6 interview study plan with weekly labs and 36 practice questions on lifecycle, thresholds, executors, data and CI.

Sep 27, 2025 - 17:21
Nov 9, 2026 - 05:33
 0  73
k6 Interview Prep: 3-Week Plan and 36 Q&As (2027)

To prepare for a k6 interview, spend three weeks: first on the test lifecycle, checks and thresholds, then on scenarios, executors and test data, then on CI integration, results analysis and spoken answers. This guide gives a day-by-day plan with a lab for each week and 36 practice questions mapped to the plan.

Grafana k6 is an open source load testing tool. You write tests in JavaScript, and k6 runs them with virtual users (VUs). The current major line is k6 2.x; GitHub listed v2.3.0 as the latest release when this guide was checked in November 2026. Our other k6 posts are question banks sorted by topic: start with the k6 load testing questions for beginners, the 65+ k6 interview questions, or the real-time k6 questions on test results. This page tells you what to study in which order and how to check that you are ready.

Key takeaways

  • Learn the four lifecycle stages first (init, setup, VU code, teardown). Many follow-up questions depend on knowing what runs once and what runs per VU.
  • Checks record pass rates but do not fail a test. Thresholds do: if any threshold fails, k6 exits with a non-zero code, which is what CI uses.
  • k6 has six executors. Know the difference between closed models (VU-based) and open models (arrival-rate) before your interview.
  • Build one script per week and keep it. Interviewers often ask you to walk through a test you wrote.
  • Practise explaining results: p95 versus average, failed request rate, and whether the load generator itself was the bottleneck.

The three-week k6 study plan

WeekTopicsLab to buildQuestions
1Install, lifecycle, k6/http, checks, thresholds, built-in metrics, end-of-test summaryA smoke test and a load test for one API with p95 and error-rate thresholdsQ1 to Q12
2Scenarios and executors, stages, test data with SharedArray, parameterisation, custom metrics, tags and groupsA test with two scenarios (browsing at a fixed arrival rate, checkout ramping up) reading users from a CSVQ13 to Q24
3CI integration, outputs to Prometheus or Grafana, handleSummary, browser module, extensions, results analysisA pipeline job that runs the test and fails the build on a threshold breachQ25 to Q36 plus scenarios

A realistic daily routine

About an hour a day is enough: 20 minutes reading the relevant k6 docs page, 30 minutes writing or changing your script, and 10 minutes saying two answers aloud. Point tests at a system you own or a public demo service meant for load testing. Never load test a third-party site without permission; that question sometimes comes up in interviews too, and the right answer is that you get written approval and agree on a window.

Tools to set up on day one

  • k6 installed from the official packages or Docker image.
  • A small target API you can run locally (any framework works) so you can create slow endpoints on purpose.
  • Optional: Prometheus and Grafana for week 3. Our post on using Prometheus and Grafana together covers the setup.

Week 1: fundamentals (freshers)

1. What is k6 and what is it used for?

k6 is an open source load testing tool maintained by Grafana Labs. Tests are JavaScript files executed by a Go engine, which keeps resource use per VU low. Teams use it for smoke, load, stress, spike and soak tests of APIs and websites.

2. What are the k6 test lifecycle stages?

Init code runs once per VU and loads modules, files and options. setup() runs once before the test. The default (or scenario) function runs repeatedly for each VU. teardown() runs once at the end. Init code cannot make HTTP requests.

3. How does data from setup reach VUs?

Whatever setup() returns is passed as an argument to the default function and to teardown(). It must be JSON-serialisable, and each VU gets its own copy, so changes in one VU are not visible elsewhere.

4. What is a virtual user?

A VU is an independent execution context that runs your default function in a loop. Each VU has its own JavaScript runtime and cookie jar, so VUs behave like separate clients.

5. What is the difference between a check and a threshold?

A check asserts something about one response, such as status 200, and records a pass rate. A threshold sets a pass or fail criterion on a metric for the whole test, such as p(95)<500. Failed checks alone do not fail the run; failed thresholds do.

6. Write a basic threshold block.

export const options = {
  thresholds: {
    http_req_duration: ['p(95)<500'],
    http_req_failed: ['rate<0.01'],
  },
};

This fails the test if the 95th percentile request duration is 500 ms or more, or if more than 1% of requests fail.

7. How do you stop a test early when a threshold fails?

Use the long threshold form with abortOnFail: true, and add delayAbortEval (for example '10s') so k6 collects enough samples before deciding.

8. Which built-in HTTP metrics matter most?

http_req_duration (total request time), http_req_failed (rate of failed requests), http_reqs (count), and timing breakdowns such as http_req_waiting (time to first byte). iterations and vus describe the load itself.

9. Why look at p95 or p99 rather than the average?

Averages hide slow outliers. If 5% of users wait four seconds, the average can still look fine while the p95 shows the problem.

10. What exit code does k6 return when thresholds fail?

A non-zero exit code. Exit code 0 means all thresholds passed. CI systems use this to fail the job.

11. What types of performance test should you know?

Smoke (minimal load to check the script works), average load, stress (above normal), spike (sudden jump), soak (long duration) and breakpoint (increase until it breaks). Be ready to say which one answers which business question.

12. What is sleep() for?

sleep() adds think time between actions so VUs behave more like users. Without it, a closed-model test sends requests as fast as the server answers, which changes what you are measuring.

Week 2: scenarios and data (2 to 5 years)

13. List the k6 executors.

shared-iterations, per-vu-iterations, constant-vus, ramping-vus, constant-arrival-rate and ramping-arrival-rate.

14. What is the difference between closed and open models?

In a closed model (VU-based executors) a VU starts a new iteration only after the last one ends, so a slow system receives less load. In an open model (arrival-rate executors) k6 starts iterations at a set rate regardless of response time, which better matches real traffic arriving at a site.

15. When would you use constant-arrival-rate?

When the requirement is stated as throughput, such as "200 requests per second". You set rate, timeUnit and preAllocatedVUs; if k6 runs out of VUs it reports dropped iterations.

16. What does dropped_iterations tell you?

k6 could not start iterations on schedule, usually because it did not have enough VUs allocated. Increase preAllocatedVUs or maxVUs, or accept that the target cannot keep up.

17. How do you run two traffic patterns in one test?

Define several entries under scenarios, each with its own executor, exec function and start time. For example, browsing at a constant rate while checkout ramps up.

18. How do you load test data efficiently?

Use SharedArray from k6/data. The data is loaded once and shared read-only between VUs, which saves memory compared with every VU parsing the same file.

19. How do you give each VU a different user?

Use execution context values from k6/execution (such as the VU or iteration ID) as an index into your data array. Explain how you avoid two VUs using the same account if the system does not allow it.

20. What are custom metrics?

k6/metrics provides four types: Counter, Gauge, Rate and Trend. A Trend for "checkout duration" lets you set a threshold on a business step, not only on raw HTTP calls.

21. What are tags and groups used for?

Tags label requests and metrics so you can filter results and set thresholds on a subset, such as http_req_duration{name:login}. Groups organise a script into named sections for the summary.

22. How do you handle dynamic URLs in metrics?

Set a name tag on requests whose URLs contain IDs. Otherwise each unique URL becomes its own metric series and the results are hard to read.

23. How do you correlate a token from one response into the next request?

Parse the response (for example with res.json()), store the token in a variable, and send it in the next request's headers. If every iteration logs in, consider logging in once in setup and passing the token.

24. How do you pass environment-specific settings?

Use environment variables read through __ENV and pass them with -e on the command line, for example the base URL for staging versus a local run.

Week 3: CI, results and extensions (senior)

25. How do you run k6 in a CI pipeline?

Install k6 or use the official Docker image in a job, run the script with thresholds defined, and let the non-zero exit code fail the stage. Keep a short smoke test on every merge and a longer load test on a schedule.

26. How do you send results to Grafana?

Use a real-time output, such as Prometheus remote write, or the cloud output for Grafana Cloud k6. Then build dashboards that place k6 metrics next to server metrics for the same time window.

27. What does handleSummary do?

handleSummary() runs at the end of the test and lets you create your own summary output, such as a JSON or JUnit-style file that a CI tool can display.

28. What is the k6 browser module?

k6/browser drives a Chromium-based browser for front-end performance checks, such as page load metrics. It costs far more resources per VU than protocol tests, so teams usually combine many protocol VUs with a few browser VUs.

29. Which protocols does k6 support besides HTTP?

Built-in modules include k6/net/grpc for gRPC and k6/websockets and k6/ws for WebSockets. Other protocols come through extensions.

30. What are k6 extensions?

Extensions add Go-based modules or outputs to k6. You build a custom binary with xk6 that includes the extensions you need, for example a database or messaging client.

31. How do you know the load generator is not the bottleneck?

Watch CPU, memory and network on the machine running k6. If it is saturated, the results reflect the client, not the server. Split the load across machines or use a distributed runner.

32. How do you run distributed tests on Kubernetes?

The k6 Operator runs a test across several pods in a cluster. Mention that you still need to aggregate results in one place, such as Prometheus or Grafana Cloud k6.

33. How do you set a realistic target?

Start from production data: peak requests per second, typical user journeys and current latency. Agree on service level objectives with the team, then turn them into thresholds.

34. What would make you distrust a k6 result?

A high failure rate with fast responses (often errors returned quickly), dropped iterations, a saturated load generator, caching that real users would not hit, or a test environment much smaller than production.

35. How do you compare two builds?

Run the same script with the same load against both, record results in the same output, and compare p95, error rate and throughput. Run more than once so you know the normal variation.

36. How do you explain a failed test to a product manager?

Lead with impact: "At 300 checkouts a minute, one in twenty users waited more than three seconds." Then give the cause you found and the next test you will run.

Scenario drills for the last weekend

  • Your test passes locally but fails in CI with many connection errors. Check whether the CI runner can reach the target, whether it has the resources for the VU count, and whether the target rate-limits the runner's IP.
  • p95 jumps after ten minutes in a soak test. Correlate with server memory and connection pool metrics; a leak or pool exhaustion is a likely cause.
  • The team wants "1,000 users". Ask what a user does and how often, then convert it to an arrival rate or a VU count with think time, and say which one you chose.

Readiness check

AreaYou are ready when you can
LifecycleSay what runs once and what runs per VU without notes
ThresholdsWrite a threshold block from memory and explain the exit code
ExecutorsPick an executor for a stated requirement and justify it
DataExplain SharedArray and how you avoid duplicate test users
CIDescribe the pipeline job you built and how it fails
ResultsExplain one result you distrusted and why

k6 tests are usually part of a wider CI/CD and monitoring setup. Our DevOps training covers pipelines and observability, in a classroom in Kharadi, Pune and live online across India.

FAQ

How long does it take to prepare for a k6 interview?

About three weeks at an hour a day if you know basic JavaScript and HTTP. Add time if JavaScript is new to you.

Do I need to know JavaScript well for k6?

You need basics: functions, objects, arrays, imports and JSON handling. k6 scripts are usually short.

Is there an official k6 certification?

Check Grafana Labs' own training pages before relying on any certification claim; this guide does not depend on one.

What is the most common k6 interview question?

The difference between checks and thresholds, followed closely by choosing an executor.

Should I learn the browser module?

Know what it is and when it helps. Most k6 interview questions focus on protocol-level tests.

How is this guide different from other k6 question lists?

It is a sequenced plan with labs and questions per week. The question banks linked above go deeper on each topic.

References

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.