Gatling Get Started
Gatling
Gatling is load testing framework based on Scala
You still use JMeter for load test?
Gatling is powerful and easy to use. Reporting function is nice.
Install
Just download and decompress.
gatling-charts-highcharts-bundle-x.x.x
I tried 2.2.3(2016/12/15) on Mac
Start Sample Script
There are some samples by default
Start script
sh bin/gatling.sh
You can see list of script. Let’s try 1
GATLING_HOME is set to /Users/dj110/lib/gatling-charts-highcharts-bundle-2.2.3 Choose a simulation number: [0] computerdatabase.BasicSimulation [1] computerdatabase.LocalHostTestSimulation [2] computerdatabase.advanced.AdvancedSimulationStep01 [3] computerdatabase.advanced.AdvancedSimulationStep02 [4] computerdatabase.advanced.AdvancedSimulationStep03 [5] computerdatabase.advanced.AdvancedSimulationStep04 [6] computerdatabase.advanced.AdvancedSimulationStep05 1 Select simulation id (default is 'localhosttestsimulation'). Accepted characters are a-z, A-Z, 0-9, - and _ Select run description (optional) Simulation computerdatabase.LocalHostTestSimulation started...
Select 1 and others aren’t required to do. Press Enter.
Run script and the result is under results directory
Try my script
As next, let’s try our own script.
Please add script under /user-files/simulations/computerdatabase/advanced
LocalHostTestSimulation.scala
package computerdatabase import io.gatling.core.Predef._ import io.gatling.http.Predef._ import scala.concurrent.duration._ class LocalHostTestSimulation extends Simulation { val httpConf = http .baseURL("http://localhost:8080") // Here is the root for all relative URLs val scn = scenario("Sample") .exec(http("request_1") .get("/")) .pause(100 milliseconds) setUp(scn.inject(rampUsers(20) over(5 seconds)) .protocols(httpConf)) }
This sample tries 20 requests / 5 seconds.
Try localhost:8080
I tested my spring boot + Angular 2 + webpack Sample app SpringBootAngular2
The results is under results directory
Reports
Report shows how many request success or fail, and response time, average response time etc…