Migrate from JMeter to Gatling.

Move a JMeter load test to Gatling: thread groups, HTTP samplers, assertions, extractors, CSV data, timers and transaction controllers mapped to Gatling's Java DSL, with injection profiles, assertions, a checklist, gotchas and live numbers for both tools.

JMeter (live data): 9,611 GitHub stars. 0 GitHub releases in the last 60 days. last GitHub activity 2026-11-21

Gatling (live data): 6,965 GitHub stars. 2 GitHub releases in the last 60 days, latest v3.16.1. last GitHub activity 2026-11-19

Users, ramp-up and duration: JMeter: Thread Group Number of Threads (users): 50 Ramp-up period (seconds): 30 Loop Count: Infinite Specify Thread lifetime: Duration (seconds) 300 → Gatling (Java DSL): setUp( scn.injectClosed( rampConcurrentUsers(0).to(50).during(30), constantConcurrentUsers(50).during(270) ) ).protocols(httpProtocol); (A Thread Group is a closed model: a fixed pool of users looping. injectClosed is the direct match; the scenario needs a loop (forever or during) so users keep going.)

Fixed number of loops: JMeter: Thread Group Number of Threads (users): 5 Loop Count: 10 → Gatling (Java DSL): ScenarioBuilder scn = scenario("Checkout") .repeat(10).on( http("Users").get("/users") ); setUp(scn.injectOpen(atOnceUsers(5))); (A Gatling user runs its scenario once and leaves unless you loop. repeat(n) is the Loop Count.)

Arrival rate: JMeter: Open Model Thread Group Schedule: rate(1/sec) random_arrivals(2 min) rate(3/sec) → Gatling (Java DSL): setUp( scn.injectOpen( rampUsersPerSec(1).to(3).during(120).randomized() ) ); (Same shape: the rate rises from one to three users per second over two minutes, with random arrival spacing.)

HTTP request with defaults: JMeter: HTTP Request Defaults Protocol: https Server Name or IP: api.example.com HTTP Request "Users" Method: GET Path: /users → Gatling (Java DSL): HttpProtocolBuilder httpProtocol = http .baseUrl("https://api.example.com") .acceptHeader("application/json"); http("Users").get("/users") (The protocol object is the Defaults element: base URL, shared headers, redirect and connection settings, passed once to setUp(...).protocols(...).)

POST with a JSON body and headers: JMeter: HTTP Header Manager Content-Type: application/json HTTP Request "Login" Method: POST Path: /login Body Data: {"email":"a@b.co","password":"secret"} → Gatling (Java DSL): http("Login").post("/login") .asJson() .body(StringBody("{\"email\":\"a@b.co\",\"password\":\"secret\"}")) (asJson sets the Content-Type and Accept headers. Other headers go on the request with .header("name", "value") or on the protocol for all requests.)

Assert status and body text: JMeter: Response Assertion Field to Test: Response Code Pattern Matching Rules: Equals Patterns to Test: 200 Response Assertion Field to Test: Text Response Pattern Matching Rules: Contains Patterns to Test: Welcome → Gatling (Java DSL): http("Home").get("/") .check( status().is(200), substring("Welcome") ) (A failed check marks that request KO in the report and the user carries on; add exitHereIfFailed() after it to stop the user, as a failed assertion with "stop thread" would.)

Response time limit: JMeter: Duration Assertion Duration in Milliseconds: 500 → Gatling (Java DSL): // per request, like the Duration Assertion .check(responseTimeInMillis().lte(500)) // or for the run, evaluated at the end setUp(...).assertions( global().responseTime().percentile(95.0).lt(500), global().successfulRequests().percent().gt(99.0) ); (The check fails single requests. The assertion judges the whole run and fails the simulation, which fails the build.)

Extract a value from JSON: JMeter: JSON Extractor Names of created variables: token JSON Path expressions: $.token Match No.: 1 → Gatling (Java DSL): http("Login").post("/login") .check(jsonPath("$.token").saveAs("token")) http("Me").get("/me") .header("Authorization", "Bearer #{token}") (saveAs puts the value in the user's Session; #{token} reads it back. jmesPath is there too if you prefer that syntax.)

Extract with a regular expression: JMeter: Regular Expression Extractor Name of created variable: csrf Regular Expression: name="csrf" value="(.+?)" Template:

$ → Gatling (Java DSL): .check(regex("name=\"csrf\" value=\"(.+?)\"").saveAs("csrf")) (One capture group is returned as the value, like Template
$. Use find(n) or findAll() where the extractor used Match No.)

Reference a variable: JMeter: HTTP Request Path: /users/${userId} → Gatling (Java DSL): http("User").get("/users/#{userId}") (Gatling's Expression Language uses #{name}. The older ${name} form is obsolete because it clashed with Scala and Kotlin string interpolation, so JMeter paths need the swap.)

CSV test data: JMeter: CSV Data Set Config Filename: users.csv Variable Names: email,password Recycle on EOF?: True Sharing mode: All threads // then ${email} and ${password} in samplers → Gatling (Java DSL): FeederBuilder<String> users = csv("users.csv").circular(); ScenarioBuilder scn = scenario("Login") .feed(users) .exec( http("Login").post("/login") .formParam("email", "#{email}") .formParam("password", "#{password}") ); (The header row names the attributes. circular() is Recycle on EOF; the default queue() hands out each record once. Feeders are shared by all users, as Sharing mode All threads is.)

Think time: JMeter: Constant Timer Thread Delay (in milliseconds): 1000 Uniform Random Timer Random Delay Maximum (in milliseconds): 2000 Constant Delay Offset (in milliseconds): 1000 → Gatling (Java DSL): .pause(1) .pause(1, 3) .pause(Duration.ofMillis(1500)) (A timer runs before every sampler in its scope; a pause runs where it sits in the chain. Put one after each request you want paced.)

Group requests as a transaction: JMeter: Transaction Controller "Checkout" Generate parent sample: checked (child samplers: Cart, Pay) → Gatling (Java DSL): group("Checkout").on( http("Cart").post("/cart").body(cartBody), http("Pay").post("/pay").body(payBody) ) (The report shows the group with its own cumulated response time, and assertions can target it with details("Checkout").)

Run something once: JMeter: setUp Thread Group (before the test) tearDown Thread Group (after the test) Once Only Controller (once per thread) HTTP Request "Login" → Gatling (Java DSL): @Override public void before() { /* setUp Thread Group */ } @Override public void after() { /* tearDown Thread Group */ } ScenarioBuilder scn = scenario("Shop") .exec(http("Login").post("/login")) // once per user .repeat(10).on(browse); (before and after run once per simulation. Anything placed in the scenario before the loop runs once per user, the Once Only Controller case.)

Set a variable in code: JMeter: JSR223 PreProcessor (groovy) vars.put("orderId", UUID.randomUUID().toString()) → Gatling (Java DSL): .exec(session -> session.set("orderId", UUID.randomUUID().toString())) (Session is immutable: set returns a new Session, and the lambda must return it. Read values back with session.getString("orderId").)

Cookies and redirects: JMeter: HTTP Cookie Manager HTTP Request Follow Redirects: checked → Gatling (Java DSL): // nothing to add: cookies and redirects are handled per user http.disableFollowRedirect(); // only if the plan had Follow Redirects off (The HTTP protocol supports cookies, caching and redirects like a browser does, per virtual user. Opt out on the protocol when the plan did.)

Run from the command line: JMeter: jmeter -n -t plan.jmx -l results.jtl -e -o report/ → Gatling (Java DSL): ./mvnw gatling:test -Dgatling.simulationClass=checkout.CheckoutSimulation (The HTML report is written at the end of every run; there is no flag to add. Gradle and the npm CLI have the same goal.)

Record a browser session: JMeter: HTTP(S) Test Script Recorder (proxy on port 8888, browser pointed at it) → Gatling (Java DSL): ./mvnw gatling:recorder # proxy mode, or convert a saved HAR file (The Recorder produces a simulation with requests, pauses and tags as comments. It is a starting point for the HTTP part, not a .jmx importer.)

Checked against: jmeter 5.6.3, gatling 3.16.1 (latest GitHub release, 2026-11-19)