Get the most out of your performance testing by following our tips.
Whether you’re new to Gatling, writing your first scripts and learning the platform, or you’re an established Gatling pro, already using Gatling Enterprise Cloud, it’s always a good idea to touch base on some of the practices and tips that can help you build a better load testing strategy.
At Gatling we also get lots of questions from our users and are hoping to answer some of those in this post. If you have any specific questions that we don’t answer in this post please feel free to reach out to us on our Community platform or to email us at email@example.com and we’ll get back to you with answers and maybe share them in a future post so we can help other users with the same questions.
With all that said, let’s get into some best practices for your load testing strategy:
Perfect your user journey:
A basic Gatling Script is made up of three parts, the protocol configuration, scenario definition and injection profile. The user journey or scenario definition, the second of 3 parts of your Gatling Script, makes up the bulk of your script. In the user journey you define the steps that your virtual user will take when simulating traffic on your website or web application. In order to get the most realistic simulation you’ll need to replicate the actual steps that users are taking using your application or website as closely as possible. This makes sure you’re testing the parts of your application that are actually the ones most likely to experience load and that you’re not spending your time and resources on testing pieces of your application that aren’t heavily used.
What can I use to build better user journeys?
Using analytics and tracking tools you should be able to get a good idea of how your users are using your website or application. You can even use conditional logic and loops available in Gatling’s DSLs to create branching logic and to more accurately represent a user’s journey. Gatling also allows you to create simulations with Dynamic Data to further replicate real life scenarios so that the data involved in a simulation can be different every time it’s used.
Don’t forget to use set pauses, also in Gatling’s DSLs, to make sure you’re making your journeys reflect the speed with which you expect users to use your site.
Involve your whole team (or as many as possible):
As a practice load testing is generally done by a few software engineers, site reliability engineers, or QA team members. However, to truly get the most out of your load testing strategy with Gatling Enterprise Cloud it’s a good idea to involve as many stakeholders as possible. Not every team member will necessarily need to be writing or creating scripts or involved in every project so be sure to set up your team and user permissions correctly. It is a good idea for every team member though to at least be involved in reading the reports and understanding the subject matter.
How can different stakeholders benefit from being involved in the load testing process?
While software engineers might be the ones making changes based on the results of the load tests, other team members can also benefit from being part of the process or viewing the reports. Other team members can include…
- Project managers and Product teams, who will be happy to see the progress they are making.
- Devops teams will like to know how the application performs so they can predict the resources that they will need under various conditions.
- UX/UI designers will learn which features require more resources for future projects and be able to help adjust and create user journeys.
Gatling Enterprise Cloud provides you with everything you need to share your load tests and results with your full team to make sure everyone is on the same page.
Monitor your injector usage:
With Gatling Enterprise Cloud version one of the advantages you get is the ability to monitor the CPU usage of your load injectors. This is especially useful for the Cloud Version because pricing is based on how many injectors you use. So if you monitor your injector usage and find you can use 1 injector instead of 2 you can perform twice the testing on a monthly basis.
How much load can one injector generate on Gatling Enterprise Cloud?
This is actually the most common question we receive from people interested in Gatling Enterprise and it’s not easy to answer. From a hardware perspective the EC2 injectors that we use from AWS can simulate up to 40,000 virtual users per second or the equivalent of 300,000 requests per second. However, not all requests are built equally and some may take more work from the injectors than others. Start with as few injectors as you think is possible and check the injector monitoring tab of your report. Here you’ll be able to see how much of the injectors’ CPUs you’re using and decide if you can use more or less?
When should I use more injectors?
Obviously if you’re checking the injector usage and you’re putting a lot of stress on the injectors you should consider adding more to be sure it’s not affecting the results of your simulation. Of course, the other reason to use different injectors is if you want to change the geographical distribution of your virtual users. You should be using analytics and doing this anyways to be sure your simulated traffic is reflecting your actual user base as closely as possible.
Integrate with your CI/CD or scheduling tool
Load testing is a critical part of your performance testing strategy and leaving it until the end of a project is a good way to cause extra problems and create time sinks for your whole team. We’ve written a lot in previous weeks about Continuous Integration, Continuous Deployment, Continuous Delivery and the different ways that you can use Gatling to perform load tests with all of the above. I highly recommend that you go back and read these full posts to help you decide which strategy works better for you. However, in case you don’t have time, here’s the quick summary. Gatling Enterprise Cloud has native integrations with some of the most popular CI/CD tools on the market including Jenkins, Teamcity, and Bamboo; additionally you can use our CI script to help build an integration for any other CI/CD provider. We’ll also be adding additional integrations in the future so keep an eye out for future news on which CI/CD integrations will be coming next.
Once you’ve integrated with your CI/CD provider you can set your tests to run in your usual testing process or schedule them to run so you can make sure you’re constantly measuring your performance and building a scalable application.
Test on staging environments with a dedicated IP
While your test environment might not match your production environment it’s generally a better idea to test on a staging environment. You could risk accidentally taking down your production environment with your tests and traffic on your production environment from actual uses could skew the results of your tests.
However, many staging environments will be blocked from public access with a firewall? How do we manage to test on these environments then? Simple, we use a dedicated IP (or several dedicated IPs). Dedicated IPs can push all of your traffic and simulated users through specified IP addresses which you can unblock on your firewall. This way your simulated traffic can get through and you can test your application without public traffic interfering with your results or possibly damaging your production environment.
Use Gatling’s resources before you get started
Are you brand new to Gatling or load testing? Before you start with Gatling Enterprise Cloud you should consider the below resources to learn some load testing basics:
The Gatling Academy: The Gatling Academy contains 3 modules to help get you started with Gatling. You’ll learn the basics, how to test an ecommerce shop, and how to test a RESTful API using our Scala or Java DSLs.
The Gatling Community: Gatling’s Open Source version has over 12 million downloads! Our open source community is full of helpful users who can help you solve issues or inspire your scripts. Many questions are even answered by Stephane Landelle, Gatling’s creator.
The Gatling Documentation: We have open source and enterprise documentation to answer all of your questions about the basic and advanced features you can find for either.
The Gatling Enterprise Cloud Support Portal: Found a bug? Having issues with a Gatling Enterprise Cloud feature? Create a ticket here and our Gatling experts will get back to you with a resolution. Please keep in mind that this portal is for Gatling Enterprise issues only, open source issues should go to the Gatling Community.
The Gatling Enterprise Cloud Tutorial.
Start testing on Gatling Enterprise Cloud today
The best time to start load testing is immediately. Click here to get your free trial with 60 credits or one free hour of testing today.
Do you have other questions or tips about load testing or Gatling that you’d like to share? Feel free to email them to Pdutka@gatling.io and I’ll be sure to include them in a future article.
→ Here are some other tech oriented articles that might interest you:
November 30, 2022
6 Standout Benefits of Private Locations
November 22, 2022
Continuous Delivery Best Practices: our top 10 tips
November 17, 2022
Black Friday Online Traffic – How to Prepare
November 2, 2022
Why we test: the beginners guide to why load testing is important
October 18, 2022
MythBusters: Dispelling 4 Gatling Misconceptions