1.7 KiB
1.7 KiB
gatling-spring-boot
Companion code for the ankurm.com post Load Testing Spring Boot with Gatling's Java DSL (and How It Compares to k6).
A tiny Spring Boot app whose /api/quote/{symbol} endpoint calls a simulated slow dependency with limited capacity
(8 workers x 50 ms = about 160 requests/s, queue of 100, then HTTP 503), plus Gatling Java DSL simulations that
find the knee, and the same test written for k6.
| Tool | Version | Source |
|---|---|---|
| Spring Boot | 4.1.2 | maven-metadata.xml (latest GA; 4.2.0-RC2 is not GA) |
Gatling (gatling-charts-highcharts) |
3.16.0 | maven-metadata.xml; the report itself says released 2026-09-29 |
gatling-maven-plugin |
4.21.12 | maven-metadata.xml |
| k6 | v2.3.0 | dl.k6.io deb package, unpacked without installing |
| JDK | 25 |
Run
./scripts/run-all.sh # about 6 minutes; regenerates everything in output/
K6=/path/to/k6 ./scripts/run-all.sh # include the k6 steps (skipped when k6 is not found)
Load numbers depend on the machine: treat them as indicative. Single runs: mvn test-compile gatling:test -Dgatling.simulationClass=lab.gatling.KneeStepsSimulation
(start the app first: mvn package -DskipTests && java -jar target/gatling-spring-boot-lab-1.0.0.jar).
Files
src/main/java/lab/gatling/the app:DownstreamPool(the bounded pool),QuoteControllersrc/test/java/lab/gatling/simulationsBasicSimulation,KneeStepsSimulation,KneeRampSimulation,ClosedModelSimulation,FailingAssertionSimulation, andSaturationTest(JUnit)k6/knee.js,k6/threshold-fail.jsthe k6 equivalentsscripts/run-all.sh,scripts/analyze.pyrun everything, turn reports into tables and the chartoutput/captured real output of the last run