Gatling is a lightweight stress testing tool backed by Scala, Akka, and Netty. It works asynchronously if the underlying HTTP request is non-blocking. It uses messages for virtual user simulation than thread per virtual user. Because of this, it consumes lesser system resources to run the load test. In this article let us see a REST endpoint load testing by following the below steps.
Step 1: Download the Gatling bundle from http://gatling.io/#/resources/download . The folder structure of GATLING_HOME is explained below.
Step 2: Set GATLING_HOME and JAVA_HOME environment variables and write a sample simulation using Scala. As a java developer you no need to have strong Scala knowledge to write Gatling simulations with Scala. We need to have very basic knowledge. A simulation is given below to test a REST endpoint.
In the above simulation, we are ramping up the 1000 users in 10 seconds. Once the simulation script is ready, go to the bin folder and launch the gatling.bat/gatling.sh. The script will run the simulation available under “simulations” folder and generates the reports under the results folder.
The sample report is given below.
In the coming article, we will see how to use Gatling maven integration and additional features like feeders, externalizing the properties, etc. Till then, Stay Tune!!!