Septeni Engineer's Blog

セプテーニエンジニアが綴る技術ブログ

Automation of Load Testing by Gatling

Gatlingによる負荷試験の自動化

In this tutorial we will create an load testing by using Gatling Tool. First, I am going to tell you about what is load testing and what is the gatling tool. Then, I will show you the simple scenario and results. Tips for reading this tutorial, I would suggest you read this tutorial step by step and I hope you will enjoy it too.

[Requirements]

  1. Scala Programming
  2. IDE such as IntelliJ IDEA (https://www.jetbrains.com/idea/)
  3. Gatling API (http://gatling.io/#/resources/download)
  4. Gatling's SBT plugin (https://github.com/gatling/gatling-sbt-plugin-demo)

Background

1.What is Load Testing ?

Load Testing is the process of putting demand on our service and measuring it response *1

2.What is Gatling Tool ?

Gatling is an open-source load testing framework based on Scala, Akka and Netty *2

Example Scenario

In this section, I will show you the simple scenario by using Gatling tool. First, I will define the user story representative of what really happens when users use our service. Then, let's map the user story into code. Last, test it.

[User Roles]

  1. Users: They can login and browse AdAccount list

  2. Admins: They can login, browse and search AdAccount list

[Mapping Roles to Code]

1.User:

f:id:k_chindamaikul:20160718124440p:plain

2.Admin:

f:id:k_chindamaikul:20160718124449p:plain

[Simulation Activity]

User:

  1. 700 users arrive at the service

  2. Each users login to the service gradually

  3. Each users browse AdAccount list gradually

Admin:

  1. 500 admin-users arrive at the service

  2. Each admins login to the service gradually

  3. Each admins browse AdAccount list gradually

  4. Each admins search AdAccount gradually

f:id:k_chindamaikul:20160718141008p:plain

[Run all simulations]

cmd> gatling: test

[Results]

We can generate the graph which showing the number of request and response time by using gatling tool. X-axis is the responding time. Y-axis is the number of request.

f:id:k_chindamaikul:20160718141110p:plain

We also can generate the active user graph as the figure below:

f:id:k_chindamaikul:20160718141814p:plain

Reference