The open-source community often discusses whether to use JMeter or Gatling for load testing. Both are strong tools, and they become even stronger through Taurus. This post covers the differences between Gatling and JMeter and shows you how to run a Gatling test easily through Taurus. This blog post is based on the webinar “Load Testing at Scale Using Gatling and Taurus,” which you can view for free here.
What Is Gatling?
Gatling is an open-source, cross-platform, load testing Java application that uses Scala scripting language. Gatling is a command line tool, i.e., it has no GUI or Web UI, which implies a certain level of technical knowledge for its users (unless you use it through Taurus, which we will discuss further on).
Gatling enables its users to enjoy the full power of working with a programming language, without the limits of GUI DSL. It also has easy-to-use custom code pieces and extra libraries, flexible load-injection profiles, and an asynchronous concurrency model, which saves resource usage as one thread can serve many VUs and connections.
Gatling vs. JMeter
While Gatling and JMeter have different features, we don’t recommend one over the other. Rather, they are both strong and have similar abilities (when JMeter is used with its plugins). Therefore, it’s up to you to choose which one you prefer and like to work with.
|JMeter + plugins||Gatling|
|Scripting approach||Simple GUI; fit for non-techies
Hard to navigate through script
|Scala; requires coding skills
Easy to search through script
|Load profiles||Supports arrival-based injections
Supports hits' and requests' growth loads
|Supports arrival-based injections
Supports hits' and requests' growth loads
|Community and popularity||More popular
Less skilled users
More content, tools, integrations, and services
Higher-skilled users; found in larger organizations that hire technical specialists
Less content, tools, integrations, and services
While Gatling is a powerful tool, it has a few disadvantages:
Not for beginners. The larger number of prerequisites and high technical skills that are needed make it hard to use for beginners.
No real-time reports. Rich real-time reports are crucial for load testing nowadays. Developers need to be able to run a test and analyze the results immediately.
No reports storage. Reports aren’t collaborative, can’t be shared between team members and can’t be analyzed over time to identify KPI trends. This is true for JMeter as well.
No distributed testing. Tests can be run only on your local machine. JMeter has limited distributed testing.
Slow startup time (especially for complex scripts).
The Solution: Taurus for Gatling Users
Simplified scripting. Taurus scripts are very easy, and even a list of URLs is enough to start running a load test. Users can use Gatling without having to learn Scala or understand the Gatling file layout, load profile specifications or other requirements.
Automation. When you run tests every day, any second you lose becomes a problem. Taurus makes everyday usage convenient by automating tests and by integrating with Continuous Integration tools like Jenkins.
Reporting and scaling capabilities. Taurus answers modern requirements and extends existing open-source tools capabilities by providing rich real-time reports. With BlazeMeter (no payment required) these reports are also stored. Storage abilities enable developers to conduct KPIs analysis over time over complex correlations.
Heterogeneous testing. Taurus enables easily running Gatling and Selenium at the same time. This way, developers can generate the backend load test and track the front-end user experience at the same time.
How to Use Gatling With Taurus
First, install Taurus (which is awesome so it installs Gatling for you).
Now, create a configuration file. The Taurus configuration file has two parts: the execution and the scenarios.
execution: - executor: gatling scenario: blazedemo concurrency: 10 ramp-up: 30s hold-for: 2m scenarios: blazedemo: default-address: blazedemo.com headers: X-Tracking: false Accept: “*/*” requests: - url: / headers: Accept: text/html assert: - contains: - “ .+sometext.+” subject: body regexp: true not: true - url: /reserve.php method: POST body: ‘Some Body Data’ think-time: 2s assert: - contains: - 200 subject: http-code not: true
This test examines the Blaze demo website. By using the Gatling load testing tool, it tests 10 concurrent virtual users, with a ramp-up time of 30 seconds, the load is held then for two minutes. The test specifies GET requests with asserts it to include word “sometext,” and then sends a POST request to blazedemo/reserve.php with
Some Body Data in the body, defines a two-second think time before sending the requests, and asserts that the HTTP code isn’t 200.
To run the test type:
Taurus will show you KPI results in real-time, as fast as they appear on Gatling. KPIs include latency times, response codes, percentiles, etc.
Taurus doesn’t require scripting, but it does generate a Scala file internally, which looks like this:
As you can see, Taurus scripting language is easy, and it is much easier than Scala. It also enables you to go back, interrupt the test and edit the file, if you need to.
You can also view the reports of your Taurus test on BlazeMeter without having to sign up for BlazeMeter. Just add
-report to your command line, and CA BlazeMeter will open up with statistics, KPI correlations, timeline reports, etc. These reports can be shared between team members.
Congratulations! You can now easily run Gatling through Taurus and view report results on BlazeMeter.