Demo project for online YouTube stream #46 about using Gatling tool for performance testing of backend microservice.
This project contains a Gatling performance test for the backend service located
in the backend-service-under-test
folder. The test simulates various user loads and interactions
with the service's API endpoints.
You can view the online stream on YouTube after making a donation to support my volunteering initiative to help Ukrainian Armed Forces.
☕ Please, visit the Buy Me a Coffee.
Thank you in advance for your support! Слава Україні! 🇺🇦
View the announcement of the online stream on YouTube:
The only simulation in this project, GetProductsSimulation
, performs the following actions:
- GET /products: Retrieves a list of products filtered by price and size.
- GET /products/{id}: Retrieves details of a random product from the list obtained in the previous step.
- PUT /products/{id}: Updates the stock of the retrieved product.
The simulation includes different user load patterns:
- nothingFor(Duration.ofSeconds(2)): No users for the first 2 seconds.
- atOnceUsers(100): 100 users at once.
- rampUsers(100).during(5): 100 users ramping up over 5 seconds.
- constantUsersPerSec(300).during(80): 300 users per second for 80 seconds.
- constantUsersPerSec(300).during(10).randomized(): 300 users per second for 10 seconds with randomized intervals.
- stressPeakUsers(1000).during(15): 1000 users over 15 seconds.
Ensure that the backend service is running before executing the Gatling test.
The backend project can be found in the backend-service-under-test
folder.
Follow the instructions in the backend-service-under-test README
to start the service.
To run the simulation using the Gradle wrapper, use the following command:
./gradlew gatlingRun
This command will execute the GetProductsSimulation
and generate a report of the performance test results.
The gatling.conf
file contains the following settings:
gatling.charting.indicators.lowerBound=200
gatling.charting.indicators.higherBound=500
These settings define the lower and higher bounds for charting indicators in the generated reports.
To build the project, use the following command:
./gradlew build
This will compile the Java sources and prepare the project for running the simulation.
This project is licensed under the MIT License.