Tested with k6 v2.3.0, Apache JMeter 5.6.3 on Temurin JRE 21.0.12, Locust 2.47.0 on Python 3.13.5 (re-run 2026-11-11), Artillery 2.0.34 on Node 22.23.3; Linux, 8 vCPU / 16 GB; Locust 2026-11-11, others 2026-10-15
k6 vs JMeter is mostly a question of who writes the tests and what they hit. k6 is a single Go binary that runs load tests written in JavaScript or TypeScript. JMeter is a Java application where you build test plans in a GUI, save them as XML (.jmx) files and run them headless.
Tested with k6 v2.3.0, Apache JMeter 5.6.3 (Temurin JRE 21) and Artillery 2.0.34 against the same local JSON endpoint on 2026-10-15, and Locust 2.47.0 against that same endpoint on 2026-11-11. Every script and exit code below comes from those runs, except the Gatling snippet, which we didn’t run. devxtools.dev is independent and has no relationship with Grafana Labs, the Apache Software Foundation, Gatling or Artillery.
TL;DR verdict
Choose k6 if your team writes JavaScript or TypeScript and wants load tests as code, with thresholds that fail the CI build. Choose JMeter if your testers prefer a GUI, or you need protocols beyond HTTP such as JDBC, JMS or LDAP. Locust (Python) and Gatling (JVM, plus a JS/TS SDK) make sense when your team already works in those languages. Artillery suits Node teams that want YAML scenarios.
At a glance
| k6 | JMeter | Locust | Gatling | Artillery | |
|---|---|---|---|---|---|
| Test format | JS/TS code | GUI + XML (.jmx) | Python | Java/Kotlin/Scala DSL, JS/TS SDK | YAML + JS hooks |
| Runtime | Single Go binary | Java 8+ (JVM) | Python | JVM | Node.js |
| Virtual-user model | Goroutines running JS VMs | One OS thread per user | gevent greenlets | Asynchronous, non-blocking | Node event loop |
| Built-in protocols | HTTP, WebSocket, gRPC, browser | HTTP(S), SOAP/REST, FTP, JDBC, LDAP, JMS, SMTP/POP3/IMAP, TCP, shell | HTTP; anything you can call from Python | HTTP, WebSocket, SSE, JMS, MQTT, gRPC, Kafka, JDBC | HTTP, WebSocket, Socket.IO, Playwright |
| Free distributed load | Yes, with k6-operator TestRun in your own Kubernetes (you pay for the nodes); private load zones and managed runs need paid Grafana Cloud k6 | Yes (remote testing, RMI) | Yes (master/workers) | No (Enterprise feature) | Yes, from your own AWS/Azure account |
| CI pass/fail | Thresholds, exit code 99 | Assertions + results parsing (exits 0 regardless) | Exit 1 on any failure; custom SLOs via hook | Assertions | ensure plugin, exit 1 |
| Licence | AGPL-3.0 | Apache-2.0 | MIT | Apache-2.0 (Community) | MPL-2.0 |
| GitHub stars (2026-10-15) | 31,938 | 9,564 | 28,211 | 6,954 | 9,094 |
Writing the same test
Here’s the test we wrote in every tool: 20 virtual users, each doing a GET on /api/users followed by a 1-second pause. Each run checks for a 200 status and fails if p95 latency goes over 300 ms.
k6 (TypeScript)
k6 runs .ts files directly; we ran this file unmodified with k6 run load.ts. No build step was needed.
// load.ts
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '10s', target: 20 }, // ramp up to 20 VUs
{ duration: '20s', target: 20 }, // hold
{ duration: '5s', target: 0 }, // ramp down
],
thresholds: {
http_req_failed: ['rate<0.01'], // <1% errors
http_req_duration: ['p(95)<300'], // 95% of requests under 300 ms
checks: ['rate>0.99'],
},
};
const BASE_URL = __ENV.BASE_URL ?? 'http://localhost:4700';
export default function () {
const res = http.get(`${BASE_URL}/api/users`);
check(res, {
'status is 200': (r) => r.status === 200,
'has users': (r) => (r.json() as unknown[]).length > 0,
});
sleep(1);
}
Some k6 terms you’ll see in the docs:
- Checks are assertions. A failed check doesn’t stop the test; it only feeds the
checksmetric. - Thresholds are the pass/fail criteria for the whole run.
- Stages are shorthand for the
ramping-vusexecutor. - Scenarios and executors cover arrival-rate models, such as
constant-arrival-rate, for when you need a fixed number of requests per second rather than a fixed number of users.
JMeter (test plan)
In JMeter you normally build this in the GUI: a Thread Group, an HTTP Request sampler, a Response Assertion, a Duration Assertion and a Constant Timer. The saved .jmx file is XML. Here’s the core of ours, trimmed of GUI attributes. The full 45-line file ran as-is.
<ThreadGroup testname="Users">
<intProp name="ThreadGroup.num_threads">20</intProp>
<intProp name="ThreadGroup.ramp_time">10</intProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<stringProp name="ThreadGroup.duration">${__P(duration,30)}</stringProp>
</ThreadGroup>
<hashTree>
<HTTPSamplerProxy testname="GET /api/users">
<stringProp name="HTTPSampler.domain">${__P(host,localhost)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,4700)}</stringProp>
<stringProp name="HTTPSampler.path">/api/users</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
</HTTPSamplerProxy>
<hashTree>
<ResponseAssertion testname="status is 200">...</ResponseAssertion>
<DurationAssertion testname="under 300 ms">
<stringProp name="DurationAssertion.duration">${__P(maxMs,300)}</stringProp>
</DurationAssertion>
</hashTree>
<ConstantTimer testname="think time">
<stringProp name="ConstantTimer.delay">1000</stringProp>
</ConstantTimer>
</hashTree>
Run it in non-GUI (CLI) mode, which is how the JMeter manual says load tests should be run. The same command also writes the results file and builds the HTML dashboard:
jmeter -n -t load.jmx -l results.jtl -e -o report/ -Jhost=staging.example.com
${__P(name,default)} reads a property passed with -J, so one plan can target several environments. That’s JMeter’s counterpart to k6’s __ENV.
Note one difference in the setup. JMeter’s Duration Assertion fails each sample that takes longer than 300 ms. k6’s threshold, by contrast, judges the p95 of the whole run. If you want a percentile gate in JMeter, you compute it from the results file or the dashboard’s statistics.
The same test in Locust, Artillery and Gatling
Locust (locust -f locustfile.py --headless -u 20 -r 2 -t 30s --host http://localhost:4700):
from locust import HttpUser, task, between
class ApiUser(HttpUser):
wait_time = between(1, 1)
@task
def list_users(self):
with self.client.get("/api/users", catch_response=True) as res:
if res.status_code != 200 or not res.json():
res.failure("bad response")
Artillery (artillery run artillery.yml):
config:
target: http://localhost:4700
phases:
- duration: 15
arrivalRate: 5
plugins:
ensure:
thresholds:
- http.response_time.p95: 300
scenarios:
- flow:
- get:
url: /api/users
Artillery’s phases describe arrival rates (new virtual users per second) rather than a fixed pool of users.
Gatling (Java DSL). Not tested by us: this snippet follows Gatling’s documented DSL but wasn’t executed on our machine, so check it against the current Gatling docs:
public class UsersSimulation extends Simulation {
HttpProtocolBuilder httpProtocol = http.baseUrl("http://localhost:4700");
ScenarioBuilder scn = scenario("Users")
.exec(http("GET /api/users").get("/api/users").check(status().is(200)))
.pause(1);
{
setUp(scn.injectOpen(rampUsers(20).during(10))).protocols(httpProtocol)
.assertions(global().responseTime().percentile(95.0).lt(300));
}
}
Running in CI and failing the build
The main practical difference shows up here.
k6: a crossed threshold makes k6 run exit with code 99. In our run, tightening the threshold to p(95)<10 turned a passing build into a failing one with no extra tooling. That makes a k6 CI step a single line:
# GitHub Actions step
- run: k6 run -e BASE_URL=${{ vars.STAGING_URL }} load.ts
JMeter: non-GUI mode exited 0 even when we made 100% of samples fail their assertions. The assertions are written to the .jtl results file, but they don’t change the exit code. You need a step that parses the results. Ours reads the default CSV format, where column 8 is success:
#!/usr/bin/env bash
# Fail the CI job if any JMeter sample failed (column 8 = success in the default CSV .jtl)
set -euo pipefail
failures=$(awk -F, 'NR>1 && $8=="false"' "${1:-results.jtl}" | wc -l)
echo "failed samples: $failures"
[ "$failures" -eq 0 ]
Two standard alternatives to hand-rolled parsing:
- Taurus (
bzt, Apache-2.0) wraps JMeter and adds apassfailreporting module with criteria such asp95>300msorfail>1%; a failed criterion marks the run as failed. - jmeter-maven-plugin has a
resultsgoal (thejmeter-check-resultsexecution in its README) that fails the Maven build when the results contain errors.
Either way, it’s an extra piece you have to own, whereas k6 gates the build on its own.
Locust: exits 1 by default if any request failed (--exit-code-on-error changes the code). Latency SLOs need a small event hook. We tested this one; it exits 0 when p95 is under 300 ms and 1 when it isn’t:
from locust import events
@events.quitting.add_listener
def enforce_slo(environment, **kwargs):
stats = environment.stats.total
if stats.fail_ratio > 0.01 or stats.get_response_time_percentile(0.95) > 300:
environment.process_exit_code = 1
Artillery: the ensure thresholds make artillery run exit 1 when they fail. Watch the nesting: on 2.0.34 the thresholds had to sit under config.plugins.ensure. A top-level config.ensure block was silently ignored in our test.
Gatling: assertions(...) in the simulation fail the build through the Maven/Gradle/sbt plugin or the JS CLI.
Protocols
JMeter has the widest built-in range. Its homepage lists HTTP/HTTPS, SOAP/REST, FTP, JDBC databases, LDAP, JMS message brokers, SMTP/POP3/IMAP, TCP, native commands and Java objects. A large plugin ecosystem adds more. If you need to load-test a database or a JMS queue directly, JMeter covers it without code.
k6 covers modern API traffic. HTTP/1.1 and HTTP/2, WebSockets (k6/websockets, with the older k6/ws still present), gRPC (k6/net/grpc) and a Chromium-driving browser module (k6/browser) all ship in the binary. We imported all four on v2.3.0. Anything else comes from xk6 extensions, such as Kafka, SQL or Redis. You compile those into a custom k6 binary. Note that v2.0 removed the old k6/experimental/redis module, so Redis now goes through an extension.
Gatling covers HTTP (including HTTP/2), WebSocket, SSE, JMS, MQTT, gRPC, Kafka and JDBC, some as add-on modules. Artillery has HTTP, WebSocket, Socket.IO and a Playwright engine for real-browser load. Locust can load-test anything you can call from Python, as long as you write the client wrapper yourself.
Browser-level load (k6 browser, Artillery’s Playwright engine) costs far more resources per user than protocol-level load. Use a few browser VUs on top of protocol-level traffic. For functional browser testing, use Playwright itself.
Resource use per virtual user
The architectures differ. k6 runs each VU as a goroutine with its own JavaScript runtime. JMeter maps each virtual user to a Java thread. Locust uses gevent greenlets in a single Python process per CPU core, so you scale it with --processes or workers. Gatling and Artillery are event-loop based.
We didn’t want to repeat vendor benchmarks, so we ran a deliberately small measurement of our own:
- Setup: 200 virtual users, 30 seconds, 1-second think time.
- Target: a local endpoint with a 20 ms delay.
- Machine: 8 vCPUs and 16 GB RAM.
- Measurement: peak resident memory of the load generator’s process tree, sampled every 0.5 s.
| Tool | Peak RSS | Requests | Errors |
|---|---|---|---|
| k6 v2.3.0 | ~86 MB | ~5,800 | 0 |
JMeter 5.6.3 (CLI mode, default -Xms1g -Xmx1g heap) | ~312 MB | 5,800 | 0 |
That’s one run at a trivial load, so treat it as a rough indicator. It isn’t a capacity figure. JMeter’s number depends heavily on the heap settings, the listeners and the JVM. k6’s grows with script size, imported libraries and response bodies you keep in memory (see discardResponseBodies). Benchmark your own scenario before sizing load generators.
Distributed load
- k6: open-source k6 runs on one machine. For more load:
- k6-operator (Apache-2.0) is a Kubernetes operator that splits a test across pods in your own cluster. Its
TestRunresource is free to self-host, though you still pay for the cluster’s nodes. ItsPrivateLoadZoneresource is integrated with Grafana Cloud k6 and needs a Grafana Cloud account, billed as cloud usage. - Grafana Cloud k6 runs the test on managed infrastructure (
k6 cloud run test.js). You can also run locally and stream results there withk6 cloud run --local-execution. - In v2, the old
k6 login,pause,resumeandscalecommands and the externally-controlled executor were removed.
- k6-operator (Apache-2.0) is a Kubernetes operator that splits a test across pods in your own cluster. Its
- JMeter: remote testing is built in.
- Start
jmeter-serveron each worker, then runjmeter -n -t plan.jmx -R host1,host2from the controller. - Every server runs the full plan, so 1,000 threads on 6 servers means 6,000 threads.
- Since JMeter 4.0, RMI uses SSL by default, so you have to create a keystore (or disable SSL).
- Data files aren’t copied to the workers.
- Start
- Locust:
--masterplus any number of--workerprocesses or machines. On a single box,--processesforks one worker per core. - Gatling: the Community Edition doesn’t support distributed testing. Gatling’s FAQ says multiple load generators are an Enterprise feature.
- Artillery:
artillery run-fargate --count N(AWS),run-lambdaandrun-aci(Azure) fan out from your own cloud account. You pay the cloud bill, not Artillery.
Reporting
JMeter produces a complete static HTML dashboard with -e -o report/, or later from a results file with -g results.jtl -o report/. It includes percentiles, throughput over time and error tables, and you can archive it as a CI artifact.
k6 prints an end-of-test summary, writes JSON with --summary-export or handleSummary(), and has a built-in live web dashboard. Set K6_WEB_DASHBOARD=true, and add K6_WEB_DASHBOARD_EXPORT=report.html for an HTML file. k6 skipped the export on our 3-second run (“not enough data”), so use it on real-length tests. For long-term trends, stream metrics with --out to Prometheus remote write, InfluxDB, OpenTelemetry, Datadog, CloudWatch, Kafka and other backends, then chart them in Grafana. As of k6 2.4.0, the built-in influxdb and experimental-prometheus-rw outputs are deprecated: they still work but log a warning, and removal is planned for v3; the recommended migration path is --out opentelemetry.
Locust has a live web UI and --html reports. Gatling writes a static HTML report per run, and Enterprise adds run history and comparisons. Artillery writes JSON and can push to several observability backends.
Licensing and cost
| Tool | Licence | Paid offering |
|---|---|---|
| k6 | AGPL-3.0 | Grafana Cloud k6 |
| JMeter | Apache-2.0 | None from Apache; third-party hosted runners exist |
| Locust | MIT | Third-party hosting |
| Gatling | Apache-2.0 (Community Edition) | Gatling Enterprise |
| Artillery | MPL-2.0 | Artillery Cloud dashboards (optional) |
On k6 and the AGPL: Grafana Labs moved k6 and its other core projects from Apache-2.0 to AGPLv3 in 2021. The AGPL is a copyleft licence. Its extra conditions are mainly about distributing the software, or letting others use a modified version over a network, in which case you must offer the corresponding source. Using the k6 CLI to load-test your own services is the ordinary case. If you plan to fork k6, embed it in a product or offer it as a service, read the licence and Grafana’s licensing FAQ, and check with your own counsel. This page isn’t legal advice.
Grafana Cloud k6 pricing (grafana.com/pricing, checked 2026-10-15):
- Free tier: 500 virtual user hours (VUh) per month, with 14-day test retention.
- Pro: from $0.15 per VUh above that, plus the $19/month Grafana Cloud platform fee.
- Enterprise: custom pricing, from a $25,000/year commit.
Where Locust, Gatling and Artillery fit
Pick by the language your team already reads in code review:
- Python teams → Locust. Tests are plain Python classes and can reuse your own client libraries. Distributed mode is free, and there’s a web UI for ad-hoc runs.
- JVM teams → Gatling. It offers a typed DSL in Java, Kotlin or Scala, a JS/TS SDK, and good HTML reports. Plan for Enterprise if you need multiple load generators.
- Node teams that prefer config → Artillery. Scenarios are YAML with JS hooks, and distributed runs go through your own AWS or Azure account.
- JS/TS teams that want code and CI gates → k6.
- GUI-first QA teams or non-HTTP protocols → JMeter.
Commercial suites such as OpenText LoadRunner still show up in enterprises with existing licences and protocol needs. They’re outside this open-source comparison.
Verdict by team
- Developers adding a performance gate to a JS/TS service: k6. Write the test in TypeScript next to the code and let thresholds fail the pipeline.
- QA teams with existing
.jmxplans or non-developer testers: JMeter. The GUI, the recorder and the HTML dashboard are mature. Add a results-parsing step, Taurus or the Maven plugin to CI. - Database, JMS, LDAP or mail-server load: JMeter, or Gatling for JDBC, Kafka, JMS or MQTT.
- Python shops: Locust.
- Spring/Kotlin shops: Gatling.
- Large free distributed load: JMeter remote testing, Locust workers, k6-operator on Kubernetes, or Artillery on your own cloud account.
FAQ
Is k6 better than JMeter?
It depends on the team. k6 is better suited to developers who want tests as code in JS/TS and CI thresholds that fail the build with exit code 99. JMeter is better suited to GUI-driven testing and to protocols beyond HTTP, such as JDBC, JMS and LDAP.
Is k6 free for commercial use?
The k6 CLI is open source under AGPL-3.0, and the licence doesn’t restrict commercial use. Its copyleft conditions mainly apply if you distribute k6, or offer a modified version over a network. Grafana Cloud k6 is a paid service with a free tier of 500 virtual user hours per month. Check with your counsel for your specific case.
Can k6 replace JMeter?
For HTTP, WebSocket, gRPC and browser load tests, usually yes, though .jmx plans have to be rewritten by hand as k6 scripts. k6 can’t replace JMeter’s built-in JDBC, JMS, LDAP, FTP or mail samplers unless an xk6 extension covers that protocol.
Which is faster, k6 or JMeter?
In our small 200-VU run, k6 peaked at about 86 MB of memory and JMeter at about 312 MB for the same traffic. That’s not a general benchmark: results depend on scripts, JVM settings and hardware, so measure your own scenario.
k6 vs Locust: which should I use?
Use k6 if your team writes JavaScript or TypeScript and wants built-in thresholds. Use Locust if your team writes Python, wants free master/worker distribution or a live web UI, or needs to load-test something through a Python client library.
Does k6 support distributed load testing?
Not in the single open-source binary. The Apache-2.0 k6-operator distributes a test across your own Kubernetes cluster: the software is free, but you pay for the nodes. Private load zones and fully managed runs need a paid Grafana Cloud k6 account.
Related
- k6 · Locust · Gatling · Artillery
- Playwright: functional browser testing, as opposed to k6 browser load
- Testing hub
Sources
- k6 releases (v2.0.0 2026-05-11, v2.3.0 2026-09-21, v2.4.0 2026-11-12) and v2 release notes: https://github.com/grafana/k6/releases · v2.4.0 deprecations: https://github.com/grafana/k6/releases/tag/v2.4.0 · https://grafana.com/docs/k6/latest/release-notes/v2.4.0/
- k6 thresholds, checks, scenarios/executors: https://grafana.com/docs/k6/latest/using-k6/thresholds/ · https://grafana.com/docs/k6/latest/using-k6/scenarios/
- k6 real-time outputs list: https://grafana.com/docs/k6/latest/results-output/real-time/ · OpenTelemetry output: https://grafana.com/docs/k6/latest/results-output/real-time/opentelemetry/
- k6-operator (TestRun vs PrivateLoadZone): https://github.com/grafana/k6-operator · xk6: https://github.com/grafana/xk6
- Grafana licensing (AGPLv3 change, 2021-04-20): https://grafana.com/licensing/ · AGPL text: https://www.gnu.org/licenses/agpl-3.0.html
- Grafana Cloud pricing (k6: 500 VUh free, $0.15/VUh, $19 platform fee): https://grafana.com/pricing/
- Apache JMeter features and protocols: https://jmeter.apache.org/ · Java requirement: https://jmeter.apache.org/usermanual/get-started.html
- Taurus pass/fail criteria: https://gettaurus.org/docs/PassFail/ · jmeter-maven-plugin: https://github.com/jmeter-maven-plugin/jmeter-maven-plugin
- JMeter remote testing: https://jmeter.apache.org/usermanual/remote-test.html · HTML dashboard: https://jmeter.apache.org/usermanual/generating-dashboard.html
- Locust CLI (
--master,--worker,--processes,--exit-code-on-error):locust --helpon 2.47.0 · https://docs.locust.io/ - Gatling protocols: https://docs.gatling.io/reference/script/ · Distributed testing FAQ: https://docs.gatling.io/tutorials/faq/ · https://gatling.io/community-vs-enterprise
- Artillery engines: https://www.artillery.io/docs/reference/engines · ensure plugin: https://www.artillery.io/docs/reference/extensions/ensure · distributed runs: https://www.artillery.io/docs/load-testing-at-scale
- GitHub repository metadata (stars, licences), fetched 2026-10-15: grafana/k6, apache/jmeter, locustio/locust, gatling/gatling, artilleryio/artillery
- Our test runs: k6, JMeter and Artillery scripts and exit codes on the box, 2026-10-15; Locust 2.47.0 scripts and exit codes re-run 2026-11-11