Gatling vs k6: JVM simulations or a single Go binary?
6 min read
Gatling and k6 are both open source tools that keep load tests as code in your repository, and either one will load test an HTTP API well. Pick Gatling if your team works in Java, Kotlin or Scala, or wants an HTML report after every run with no extra setup. Pick k6 if you want one Go binary with no JVM, gRPC and browser tests out of the box, and thresholds that can stop a failing run early.
The facts in this Gatling vs k6 comparison come from each project’s own documentation and repository, checked on 9 October 2026.
| Gatling | k6 | |
|---|---|---|
| Licence | Apache 2.0; gRPC, MQTT and GraphQL under a separate component licence (repository) | AGPL-3.0 (repository) |
| Runtime | JVM; the Java SDK needs OpenJDK LTS 11 to 25 (release 3.16.0) | One Go binary with an embedded JavaScript engine (release v2.3.0) |
| Test scripts | Java, Kotlin, Scala, JavaScript or TypeScript | JavaScript, or TypeScript with the types stripped |
| Core protocols | HTTP/1.1, HTTP/2, WebSocket, Server-Sent Events, JMS | HTTP/1.1, HTTP/2, WebSockets, gRPC |
| Load model | Open or closed injection profiles | Six executors, two of them arrival-rate (open model) |
| Pass/fail | Assertions, checked after the run | Thresholds, which can also abort a run early |
| Reports | HTML report after each run | End-of-test summary; web dashboard with HTML export |
| Browser testing | None built in; the Recorder turns browser traffic into code | Built-in browser module (drives a Chromium-based browser) |
| Scaling out | Gatling Enterprise | k6-operator on Kubernetes, or Grafana Cloud k6 |
What is the difference between Gatling and k6?
The biggest difference is the runtime. Gatling runs on the JVM and you write tests with one of its SDKs, while k6 is a single compiled Go program that runs JavaScript.
Gatling’s README lists a Java SDK for Java, Kotlin and Scala, run through a Maven, Gradle or sbt plugin. Its JavaScript and TypeScript SDK installs through npm, and its command line tool downloads GraalVM, so even a JavaScript simulation runs on a JVM.
k6 installs as a package or a standalone binary with no other runtime. It runs .ts files directly too, though its TypeScript support strips the types without checking them (checked on 9 October 2026).
How do you write the same test in each tool?
Both tools can express the same test in JavaScript. Gatling calls it a simulation and describes load as an injection profile, while k6 calls it a script and describes load as a scenario with an executor.
Here is a test where ten new users arrive every second for five minutes, and the run fails if the 95th percentile tops 500 ms or more than 1% of requests fail. In Gatling’s JavaScript SDK, modelled on its first simulation tutorial:
import {
constantUsersPerSec, global, scenario, simulation,
} from "@gatling.io/core";
import { http } from "@gatling.io/http";
export default simulation((setUp) => {
const api = http.baseUrl("https://staging.example.com");
const users = scenario("API users")
.exec(http("list users").get("/api/users"));
setUp(users.injectOpen(constantUsersPerSec(10).during(300)))
.protocols(api)
.assertions(
global().responseTime().percentile(95).lt(500),
global().failedRequests().percent().lt(1),
);
});
The same test in k6, with the constant-arrival-rate executor:
import http from "k6/http";
export const options = {
scenarios: {
api_users: {
executor: "constant-arrival-rate",
rate: 10,
timeUnit: "1s",
duration: "5m",
preAllocatedVUs: 50,
},
},
thresholds: {
http_req_duration: ["p(95)<500"],
http_req_failed: ["rate<0.01"],
},
};
export default function () {
http.get("https://staging.example.com/api/users");
}
Run them with npx gatling run and k6 run script.js.
How do Gatling and k6 model load?
Both support open and closed workload models. Gatling makes the choice through the injection method you call, and k6 through the executor you pick.
In Gatling, injectOpen takes arrival rates such as constantUsersPerSec, and injectClosed takes concurrency targets such as constantConcurrentUsers. k6 has six executors: the two arrival-rate ones follow the open model, and the other four follow the closed model, where a virtual user starts its next iteration only when the last one finishes.
A k6 arrival-rate scenario starts iterations from a pool of pre-allocated virtual users, and when the pool runs dry, k6 skips iterations and counts them as dropped iterations (checked on 9 October 2026). Our guide to the open vs closed workload model explains when each model fits.
How do Gatling and k6 decide whether a test passed?
Both turn performance goals into a pass or fail result that a CI pipeline can act on. Gatling checks its goals after the run ends, while k6 can also stop a run as soon as a goal is missed.
Gatling assertions are evaluated after the simulation, and one failed assertion fails the simulation and the build. k6 thresholds end a failed run with a non-zero exit code, and a threshold set with abortOnFail stops the test the moment it fails (checked on 9 October 2026).
Which protocols and browser tests does each tool cover?
Both cover HTTP and WebSockets out of the box. Gatling adds Server-Sent Events and JMS, and k6 adds gRPC and real browser sessions.
Gatling’s README says gRPC, MQTT and GraphQL are separate components under the Gatling Enterprise Component License, capped at five concurrent users and five-minute tests without Enterprise. k6 lists HTTP/1.1, HTTP/2, WebSockets and gRPC as built-in protocols, with more through xk6 extensions such as Kafka and Redis.
For browser tests, k6 has a browser module that drives a Chromium-based browser and collects frontend metrics. Gatling’s docs describe no browser engine: the Recorder turns a browser session or HAR file into an HTTP-level simulation (checked on 9 October 2026).
How do you run a bigger test than one machine can generate?
Gatling’s open source edition generates load from one machine, and distributed runs need Gatling Enterprise. k6 can spread a test over a Kubernetes cluster with the open source k6-operator, or run it on Grafana Cloud k6.
Gatling’s installation guide lists an Enterprise account for distributed runs, which use managed load generators or private locations in your own AWS, Azure, GCP or Kubernetes account. The k6-operator splits one test across several k6 instances in a cluster (checked on 9 October 2026).
There is a third route for k6 scripts. LoadFocus, which publishes this site, runs k6 scripts on its own cloud infrastructure from 25 regions, with the users and duration taken from the test’s settings. Its script validator warns that arrival-rate scenarios run there with a fixed number of users, so an open-model script like the one above does not hold its arrival rate on LoadFocus. LoadFocus does not run Gatling simulations, so for Gatling the route to more machines is Gatling Enterprise.
What reports do you get?
Gatling writes an HTML report after every run with no setup. k6 prints a summary in the terminal and can produce an HTML report from its built-in web dashboard.
Gatling’s HTML report charts response time percentiles, users started per second and requests per second over time. k6 prints an end-of-test summary, and its web dashboard shows live charts and exports a self-contained HTML report when you set K6_WEB_DASHBOARD_EXPORT.
Which one should you choose?
Gatling fits teams on the JVM, and k6 fits teams that want one binary and JavaScript. Protocols, browser tests and scaling out settle most other cases.
Choose Gatling instead of k6 when your team lives on the JVM and wants Java, Kotlin or Scala tests built with Maven, Gradle or sbt next to the application code, when you need JMS or Server-Sent Events, or when you want an HTML report after every run with no setup.
Choose k6 instead of Gatling when you want a single binary in CI with no JVM to install, when your tests need gRPC or real browser sessions, when thresholds should stop a failing run early, or when you plan to scale out on Kubernetes with an open source operator.
FAQ
Is Gatling faster than k6? We have not measured this ourselves, so we will not name a winner. The fair test is the same scenario with both tools on your own hardware.
Can Gatling run k6 scripts? Not according to Gatling’s docs, which describe no way to run k6 scripts. The two SDKs use different APIs, and Gatling’s converters cover JMeter and LoadRunner, so a k6 script has to be rewritten as a Gatling simulation, even with the JavaScript SDK.
Can LoadFocus run Gatling tests? No. LoadFocus runs k6 scripts and JMeter test plans. To spread a Gatling simulation across several machines, use Gatling Enterprise.
Related reading
- Gatling load testing: a review of the JVM tool
- k6 vs Artillery: which load testing tool fits your team?
- Gatling vs JMeter: tests as code or a GUI test plan?
- Gatling vs Locust: JVM simulations or Python locustfiles?
- gRPC load testing: tools, setup and what to watch
The technical claims in this article have not been independently reviewed.