Introduction to Gatling



Gatling was found by Stéphane Landelle in 2015, Gatling is an 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 the performance of web applications, and its application is found in various fields of the software industry. Despite the fact that Gatling has emerged much after similar software 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 contain different scenarios of the test, its parameterization, and injection profiles.
  • Scenarios: A scenario consists of a 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 the number of virtual users a user which can be injected and how they are injected.

Performance of web applications:

The performance of a web application is nothing but how efficiently/fast the application reacts to 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 that are used for analyzing the performance of the web application.

  • Response time: Time is 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 request is 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 tests can run smoothly on local machines and cloud servers.
  • We can get the source code of the tests in the 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

The relation between Gatling and Scala

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

  • After the execution of the test, Gatling provides a Scala code as its 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 a better way of inferring decisions, some 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 the output.
  • The test report of Gatling is the performance test of a 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 fewer 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 the same thread.
  • Gatling is the only load testing tool that 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, with no need for a different plug-in.
  • The source code of the test can be created and hence, can be analyzed in a customized manner using different IDEs.
  • The codes are mostly in the human-understandable format, which can be handled by a non-technical person also.
  • Gatling provides a very straight-forward way of 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 protocols supported by Gatling, only a 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.

    • Installing the JDK

    • Navigate to JDK download page: https://gatling.io/open-source/start-testing/
    • Click the download button to download the Gatling

    • Browsing the bin folder inside the installation folder and click on the file:recorder.bat

  • After clicking the recorder.bat the following screen pops up after a 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.

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.
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 127.0.0.1

    • The proxy port must be used and set to a pre-defined port.
    • Some ThinkTime must be added when staring at 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 in the recording process is to stop the recorder.

    • 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

Alternatives to Gatling

  • Apache JMeter: This is also a good load and performance testing tool based on Java, and has uses in a wide variety of protocols
  • Locust: This load testing tool is written in python and can flood your system with a million requests. This is also an open-source tool.
  • LoadRunner: This is a performance testing software which can simulate thousands of 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 an 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, wherein 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 an important feature called VUGen(Virtual User Generator) which can easily record steps that the user performs to test an application, but it's not available in Gatling.
  • Gatling can use a 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 a wide environment just like Gatling, just it has wider ease of access on different platforms.
  • LoadRunner can use its single load generator to create almost 1000 virtual Users.
  • LoadRunner uses multiple protocols, and also multiple script protocols can be used in LoadRunner, whereas not in Gatling.
  • LoadRunner works with 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.
0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions