In short
Some teams want performance tests that look like normal code: written in an editor, reviewed in pull requests, run in CI. That's where k6 and Gatling shine.
Modern, code-based alternatives to JMeter — k6 uses JavaScript, Gatling uses Scala — often preferred by teams wanting performance tests written and version-controlled like regular code, integrated into CI/CD.

Think of it like this
A workout plan written in a notebook
Instead of fiddling with the treadmill's buttons each time, you write the plan in a notebook: 5 minutes warm-up, 20 minutes run, 5 minutes cool down. Anyone can read it, change it and repeat it. k6 and Gatling scripts are that notebook.
Watch it happen
GUI-first vs code-first tools
JMeter
- Build plans in a GUI
- Saved as large XML files
- Huge plugin ecosystem
k6 / Gatling
- Plain scripts in JavaScript or Scala
- Easy to diff and review in Git
- Thresholds fail CI builds directly
All three can load test the same app. Pick code-first if your team lives in Git and CI. Pick JMeter if testers prefer a GUI.
The big ideas
What you need to know
k6 uses JavaScript
Scripts are JavaScript, run by a fast Go-based engine. Maintained by Grafana Labs.
Gatling uses the JVM
Gatling scripts started in Scala, and newer versions also support Java and Kotlin.
Thresholds as pass or fail
Write 'p95 under 500 ms' in the script, and the run fails if it's broken.
Permission first
These tools can generate serious traffic. Point them only at systems you're allowed to test.
See it in code
Walk through the code
1import http from "k6/http";2import { check, sleep } from "k6";3export const options = {4 vus: 20,5 duration: "1m",6 thresholds: {7 http_req_duration: ["p(95)<500"],8 http_req_failed: ["rate<0.01"],9 },10};11 12export default function () {13 const res = http.get("https://test.k6.io/");14 check(res, { "status is 200": (r) => r.status === 200 });15 sleep(1);16}1/320 virtual users loop for one minute.
Save as smoke.js and run k6 run smoke.js. test.k6.io is a public site Grafana provides for practice.
Save yourself the pain
Common mistakes
Oops
Removing sleep() so each virtual user hammers the server non-stop.
Do this instead
Add think time. Real users pause, and without it 20 users behave like hundreds.
Oops
Treating check() failures as failing the run.
Do this instead
Checks are recorded but don't fail the run alone. Use thresholds to set pass or fail.
Your mission
Run k6 in five minutes
Quick check
What makes a k6 run fail automatically in CI?
Go deeper
- 1Explore k6's documentation and write a simple test script.
- 2Compare the code-based approach of k6/Gatling to JMeter's GUI-based test plan approach.
- 3Learn why code-based tools tend to fit more naturally into a CI/CD pipeline (Phase 11).
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.