Introduction to Gatling

Gatling was found by Stéphane Landelle in 2015, Gatling is a open Source load and performance testing framework. Gatling is created based on programming languages like Scala, Akka and Netty.

It is mainly developed to check and analyze performance of web application, and its application is found in various fields of software industry. Despite the fact that Gatling has emerged much after similar softwares such as JMeter and LoadRunner evolved,

Gatling is able to cope up with all the necessary requirements to run most of the protocols.

Some important terminologies while getting started with Gatling:

  • Simulations: The simulation files contains different scenarios of test, its parameterization and injection profiles.
  • Scenarios: A scenario consists of series of requests.
  • Group: Group can be used as a sub-division of scenarios
  • Requests: Gatling is able to initiate complex user behavior
  • Injection Profile:A injection means number of virtual users an user which can be injected and how they are injected.

Performance of web applications:

Performance of web application is nothing but how efficiently/fast the application reacts to the user actions.

Performance is the responsiveness of the application for the user request.

The actions/requests could be in the form of clicks or setting values or displaying the UI elements in the browser with respect to UI. At the same time, we can also test the performance of the API by raising the requests.

Understanding the performance. There are different metrics which are used for analyzing the performance of the web application.

  • Response time: Time taken for the system(web application in this case) to respond to any event.
  • Throughput: It is the flow of data or information flowing through a process.
  • System availability: It is the probability that the system is performing up to the mark when needed to.
  • Requests Rate: No of request handled per second.
  • Resources Consumption: How much system resource is being consumed.

Sample Output of Gatling


Why Gatling?

Below are some points, about why should we use Gatling:

  • Gatling is written in Scala, so it is platform independent.
  • Gatling test can run smoothly on local machines and cloud servers.
  • We can get the source code of the tests in Scala programming language without much effort.
  • Test metrics are created automatically without additional plug-ins.
  • Usage of RAM and memory are minimal with Gatling.

Supported Technologies by Gatling

  • HTTP
  • JMS
  • Web Sockets
  • Server-Sent Events

Relation between Gatling and Scala

Below are few points showing how Scala is related to Gatling:

  • After the execution of the test, Gatling provides with a Scala code as it's output.
  • Since, the output is a source code, it becomes helpful any programmer to apply some techniques like factoring, which gives Gatling an added beauty
  • In Scala all the elements, even the functions are also objects, which means better way of inferring decisions while, analyzing the Gatling test report
  • Scala is a purely object oriented language and similar to Java, so a Java programmer need not study Scala in detail while operating with Gatling output
  • Scala provided Gatling an output which is mostly an intelligent input for different systems, for analyzing output.
  • The test report of Gatling is the performance test of an web-application or related systems, that is why it is mandatory that no error occurs during the creation of the output, which is assured here by Scala
  • Since Scala is static in nature, it assures less dynamics in the source code output.

Advantages of Gatling

  • Free and Open Source
  • Gatling uses a very efficient way of handling thread, Gatling's engine is designed based on Akka.
  • Gatling can create multiple virtual users using a same thread.
  • Gatling in the only load testing tool which can make use of Async HTTP Client.
  • Gatling requires less memory compared to other load or performance testing tools.
  • All the test-parameters are ready-made at the end of the test, no need for different plug-in.
  • Source code of the test can be created and hence, can be analyzed in customized manner using different IDEs.
  • The codes are mostly in the human understandable format, which can be handled by non-technical person also.
  • Gatling provides a very straight-forward way for performing assertions in many ways.
  • The testing scenarios are automatically pipelined.
  • Only fundamentals of JAVA is required to understand the Scala program created by Gatling

Disadvantages of Gatling

There are disadvantages of using gatling, some of the disadvantages can be summarized as follows:

  • Nothing other than no of request, status and time elapsed can be seen during the execution.
  • Different support-system such as Taurus should be used to monitor minute details during the execution time.
  • Distribution of load may not be that easier and it's a bit lengthier.
  • Not all protocol supported by Gatling, only handful of protocols can be handled.
  • It's not possible to monitor the OS parameter during the test, and cannot be decided whether it's causing any bottleneck

Installing Gatling and Getting Started

It's required to install JDK 8 in the system, to get the Gatling working.

  • Navigate to JDK download page:
  • Download the required Java Development Kit(JDK).
  • jdk-download
  • Installing the JDK
  • jdk-install-next
  • Navigate to JDK download page:
  • Click the download button to download the Gatling
  • download-button-gatling
  • Browsing the bin folder inside the installation folder and click on the file:recorder.bat
  • gatling-bin-folder
  • After clicking the recorder.bat the following screen pops up after few seconds. As shown in the highlighted boxes, the port 8000, recorder mode as http_proxy and encoding as UTF-8 should be taken care of. gatling-recorder-interface

Creating the performance test scenarios

A performance test scenarios can be done by recording a scenario, to record a scenario, go to the bin folder inside the Gatling folder. And run the batch file called recorder.bat.

After clicking into this file a GUI will appear, where we have to create our requests and events. gatling-recorder Some important points to note:

  • The gatling recorder will only listen to a pre-defined port 8000.
  • The LAN settings, must be changed. For example, in the proxy the subnet mask can be
  • gatling-lan-settings
  • Proxy port must be used, and set to a pre-defined port.
  • Some ThinkTime must be added when staring the recorder, as a normal user would think for some time, before he/she clicks something.
  • Then navigate into the Web or related services and make your custom search.
  • The last step for recording process is to stop the recorder.
  • gatling-recorder-stop
  • The Scala file is created in your target folder which we named in the class box.
  • A sample view of the Scala source code in our target output folder
  • gatling-generated-code
  • Download the code file : test01.scala

Alternatives to Gatling

  • Apache JMeter: This is also a good load and performance testing tool based on Java, and has uses in wide variety of protocols
  • Locust: This load testing tool is written in python and can flood your system with a million request. This is also a open source tool.
  • LoadRunner: This is a performance testing software which can simulate thousands users and can later analyze the performance of the application

Gatling Vs JMeter

  • Gatling is applicable to some listed protocols only, where JMeter can be used for any protocol.
  • Gatling uses less memory as compared to JMeter
  • Gatling is easier to operate, whereas JMeter is a bit complex to analyze
  • Gatling Produces Scala Code which can be used in our way of uses, which is not the case of Gatling
  • Gatling can use of Async HTTP Client, where JMeter cant
  • Gatling handles cookies and cache by default, whereas JMeter does not
  • Gatling's Scala code can be used by different IDEs to infer different results, not in JMeter
  • Gatling is more powerful in case of using resources than JMeter
  • Gatling has a expressive DSL for test development, not in the case of JMeter
  • Gatling has notable support of HTTPS protocols and so also be used for JDBC and JMS load testing, where in JMeter these two protocols cannot be used
  • Gatling cannot use multi-threading and cannot allow concurrent sampling of functions, where JMeter can.
  • Gatling does not offer the facility of viewing all parameters status during execution, and an additional tool like Taurus may be helpful, but in JMeter it is of ease.
  • Gatling uses Scala, while JMeter uses Java purely.

Gatling vs LoadRunner

  • LoadRunner has a important feature called VUGen(Virtual User Generator) which can easily record steps that the user performs to test an application, but its not available in Gatling.
  • Gatling can use plug-in like Taurus which can monitor the test parameters in the time of testing, whereas in the case of LoadRunner, this is inbuilt.
  • LoadRunner offers the facility to control all the virtual users from a single dashboard, this is also the case in Gatling, just the number of Vusers is reduced.
  • LoadRunner may be applicable in wide environment just like Gatling, just it has wider ease of access in different platform.
  • LoadRunnder can use its single load generator to create almost 1000 virtual Users.
  • LoadRunner uses multiple protocol, and also multiple script protocol can be used in LoadRunner, whereas not in Gatling.
  • LoadRunner works with of CRM/ERP systems offered by Oracle, PeopleSoft, SAP and Siebel, but not Gatling
  • In LoadRunner the monitoring and analysis interface is much user friendly and easy to understand than Gatling
  • LoadRunner, when used wisely can give us an accurate picture of end-to-end system/application performance, while Gatling gives the same only after the termination of the test.

About Author Do not dare to reproduce any material from this website and republish through any means for commercial purpose.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions

Subscribe to See Videos

Subscribe to my Youtube channel for new videos : Subscribe Now