Gatling vs. Locust: What are the Differences and When to Use Them?
January 31, 2022

Gatling vs. Locust: What are the Differences and When to Use Them?

Performance Testing

Gatling and Locust are two popular open source load testing solutions. Discover the differences between Gatling vs. Locust.

In this post we compare them according to multiple capabilities, like protocol support, script execution capabilities, and monitoring. We hope we can help you choose the right one for you! 

Back to top

What's the Difference Between Gatling vs. Locust?

The main difference between Gatling and Locust is that Gatling is best for Java and Locust is best for Python. Additionally, Locust is more popular than Gatling. However, Gatling is considered easier to use.

Gatling Definition

Gatling is both an open source and a commercial performance testing solution. It is based on Scala, Akka, and Netty as its technology stack. Gatling is an easy framework to implement your tests if you have some experience in Java.

Locust Definition

Locust is an open source load testing solution. It is a more popular performance testing framework when compared with Gatling. The Locust framework is written with Python. It has an event-based implementation, so it is highly scalable. Thanks to that advantage, Locust is now being widely used and has a rapidly growing community. 

Back to top

Gatling vs. Locust: Additional Differences

Let’s look at a variety of different features and capabilities and see how the two solutions compare.

1. Pricing and License

As mentioned above, Locust is an open source load testing solution. Therefore it is available at zero cost for anyone in the field. All users can access all the features directly. It is licensed under the MIT license. Gating provides an open source tool under the Apache License v2.0. There is also a commercial version.

2. Supported Protocols

Understanding the supported protocols of the framework you are using is important to make sure it fits your needs. If you are testing multiple protocols, choose the framework that supports the most protocols you need, or you might find yourself having to use different tools.

Gatling supports the following protocols:

  • HTTP
  • Websockets
  • Server-sent events
  • JMS

Gatling can also support MQTT, Advanced Message Queuing Protocol (AMQP) and ZeroMQ.

Locust, on the other hand, was mainly built for HTTP-based testing, but it can be extended to test other protocols as well. However, this requires some additional effort. If you can write up a custom Python function to test what you need, you will not have any issue.

3. Number of Concurrent Users

This is one of the most critical factors that need to be considered when choosing a testing framework. The core value of load testing is to simulate the user load and exceed it. The exact number of users depends on the scenario and the application. Therefore the tool that you choose should be able to facilitate such different scenarios.

 Since both Locust and Gatling have a command-line approach, they save resources that can be allocated for more users. Therefore, they both support a large number of users.

The Locust user simulation model is based on an async approach, which allows Locust to easily simulate thousands of users in a single device. Gatling handles virtual users, with each having its own data. Gatling implements them as messages so it can also handle thousands of concurrent users.

4. Ramp-up Flexibility

Ramp-up flexibility is also an important factor when performing extensive load testing, so you can see how much you can increase the load. 

In Locust, when the server starts, you can give input elements to customize the load. Locust only supports a linear load. Therefore sudden spike loads cannot be tested with Locust. Gatling supports ramping up users with spike loads.

5. Test Creation and Execution

Generally, there are three steps in a performance test workflow:

  • Create
  • Run
  • Analyze

The most time-consuming step of the workflow is the test creation step, because that’s where you capture all the requirements that need to be covered. The testing scenario needs to represent what happens when a user navigates to that particular application. Therefore it is necessary to allocate more time on test creation than on running and analyzing. 

There are two ways to do testing with Gatling. One way is to use the simulation recorder which can be used to test UI elements. The recorder creates a Scala file which you can later edit if you want to add more functionalities to the test cases. However, if you want to test the product at API level you will have to write your own test cases. This can be done using domain-specific language (DSL) which is easily readable and writable. This DSL is based on Scala and it helps you to write test scripts with minimal knowledge of Scala. 

The Gatling Recorder:

A screenshot of the Gatling recorder.

With the Gatling GUI, you can configure how the requests and responses need to be recorded. We will capture the basic options that we need to configure to perform a load test. 

Following are the basic and most commonly used configuration options. You can find more advanced options here.

  • computerdatabase package
  • BasicSimulation name
  • Follow Redirects? checked
  • Automatic Referers? checked
  • Black list first filter strategy selected
  • .*\.css, .*\.js and .*\.ico in the black list filters

Recording the Scenario

In Gatling, you can simply record the user journey through the selected application. One thing to pay attention to here is to model the user journey to reflect a journey of a real user. When the recording is terminated with the “Stop” option in the recorder interface, the simulation will be created in a separate folder.


in the Gatling installation location.

At this point, a simulation file will be generated that will look like below.

A screenshot of the Gatling simulation file.


In this simulation file, you can further set up the configurations such as HTTP protocol, the number of scenarios to be considered and the details of each scenario. You can then execute it with Gatling to obtain the results.

Locust is a bit different from Gatling. It is all about coding. Therefore, you need to have basic knowledge of Python coding to create performance tests.

A screenshot of the Locust Python code.

Writing test scripts for Locust is clear and comfortable, and much more powerful. However, it can be more complex for complicated tests. The reviewing also gets complicated. On the other hand, having tests in code format is much easier than in a GUI because you can easily add fixes for the tests. Code-level test implementation also gives you room to collaborate. Even the test execution process is simpler and faster when compared to a GUI-based testing approach.

6. Result Reports

As mentioned above, after creating and executing a test, you need to monitor the results. This is where you can see the results and check how your application is running.

In Gatling, when the simulation is completed, you can view the report in the browser. Gatling supports various types of reports as shown on this page. Gatling is capable of giving a visually descriptive analysis report. This is very convenient for grasping the key points of the analysis because it consists of different types of graphs and tables representing features of the executed tests.

Locust has a very limited monitoring capability, yet it provides almost all the information required for monitoring a basic load. There is a basic Locust web server that shows all the data available for monitoring.

A screenshot of the Locust report.


A screenshot of total requests per second in Locust.

You can also run both test scripts in BlazeMeter and get advanced reporting, both in real-time and over time to see trends.

7. Real-Time Monitoring

When we run a load test, we want to immediately see the results in the metrics that we chose, so we can customize them accordingly to capture more data or to tune the test. Each time we perform a load test, we need to optimize and customize.

Locust can provide real-time monitoring when it is linked with other tools to capture the metrics and to show the metrics. For example, you can use Locust to perform load testing, export metrics with Prometheus, and display them in a visually descriptive approach using Grafana dashboards. This also works with BlazeMeter.

Similar to the Locust approach, you can also integrate the Gatling framework with other open-source monitoring tools like Grafana and BlazeMeter.

Back to top

Pros & Cons of Locust vs. Gatling



  • Supports many popular protocols like HTTP, MQTT and AMQP.
  • Gatling supports ramping up users with spike loads.
  • Simulation recorder helps to speed up the testing process.
  • Provides much better reports compared to Locust.


  • CLI does not support detailed information in runtime.
  • Due to being a java-based application, setup complexities and dependencies will be there.
  • The free version has a limited number of features.




  • As Python is a more popular language, Locust can be easily adopted by a software company.
  • The use of Python makes the implementation faster and easier           .
  • Requires less CPU utilization and can be used with limited resources.


  • The higher the user counts, the slower the execution of the code, due to the nature of Python
  • Monitoring is not as good as Gatling
  • Does not support spike loads


Back to top

When to Use Gatling vs. Locust

Both Gatling and Locust can be used for load and perform testing. You can use Locust when you have limited resources, like CPU capacity. This is because Locust requires less CPU utilization when compared to Gatling due to its “more in code” aspect. You can use Gatling in scenarios when you specifically need a more descriptive illustration of the analysis report data because Gatling already has richer monitoring tools.

After you create your tests, you can run them both in BlazeMeter to achieve more scalability, advanced reporting options, and more.



Related Resources

Back to top