New posts
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# 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
|
||||
|
||||
```bash
|
||||
./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), `QuoteController`
|
||||
- `src/test/java/lab/gatling/` simulations `BasicSimulation`, `KneeStepsSimulation`, `KneeRampSimulation`, `ClosedModelSimulation`, `FailingAssertionSimulation`, and `SaturationTest` (JUnit)
|
||||
- `k6/knee.js`, `k6/threshold-fail.js` the k6 equivalents
|
||||
- `scripts/run-all.sh`, `scripts/analyze.py` run everything, turn reports into tables and the chart
|
||||
- `output/` captured real output of the last run
|
||||
Reference in New Issue
Block a user