Testing with Apache Taurus
Scaling backend systems requires performance testing to respect the expected SLA.
Performance testing, a subset of performance engineering, is a computer science practice that strives to build performance standards into the implementation, design and architecture of a system.
There are a lot of software products on the market and one that can really help you in a few easy steps is Apache Taurus.
Taurus is a free and open source framework for Continuous Testing which helps you by hiding the complexities of running performance tests. Think of it as an automation-friendly wrapper — it cloaks nicely around JMeter, neatly covering all of its complexities and imperfections.
JMeter test scripts are usually launched via the command line. However, for every change in thread group parameters, it is necessary to open the JMeter script file in GUI mode. To avoid this, it is possible to use variables and property functions, but it is very inefficient to work via command line parameters instead of just updating a YAML file.
It is possible to integrate with open-source performance testing software, like Selenium, Locust, Gatling, or JMeter.
Why do I like it?
- Powerful, self-explanatory dashboards to share with your teammates
- It is easy to run your existing JMeter scripts and I like having interactive charts on your CLI while running the script
- It is easy to plug into different open source testing frameworks
- It could be great to plug in your CI/CD pipeline
Installation
It requires Python 2.7 or 3.5+ and one simple command:
pip install bzt
Yaml configuration
Taurus adopts the Yaml file format to describe the test configuration.
In a few lines of YAML file configuration we can already describe a lot of configuration settings:
- concurrency: the number of target concurrent virtual users
- ramp-up: the time to reach target concurrency
- hold-for: the time to hold target concurrency
- iterations: limit scenario iterations number
- throughput: apply RPS shaper, limiting maximum RPS to throughput, requires ramp-up and/or hold-for
- steps: allows users to apply stepping ramp-up for concurrency and RPS. This requires ramp-up
- scenario: name of the scenario described in scenarios part
Execution
bzt quick_test.yml
Final Result
The above image and data are useful, but a chart that we could review later on and that contains more data points would be better. It is possible to runbzt quick_test.yml -report
and the result would be:
The graph generated is updated on the fly while the script is running and it can provide immediate feedback to the user.
Apache Taurus offers the capability to change the testing framework by replacing the executor configuration. The default executor is JMeter, and it can be changed under general settings section.
Advanced Taurus Yaml Configuration
In this configuration, we define our data-sources.
The filepath
describes the file that contains a list of different payloads.
These payloads are separated via delimiter
and will be sent towards the requests.url
endpoint.
If all of the payloads are going to be used during the execution, Apache Taurus can loop
through them.
Though it may seem obvious, it is important to specify the content-encoding
to avoid characters being misinterpreted. By explicitly declaring the content-encoding, we can make sure to avoid false positives such as "Bad Request"
It is also possible to validate the backend response by using assertions.
In this case, a valid response should always contain a results
array.
If you prefer to configure your tests using a JMeter script, you can simply include the path to this script in the YAML file.
Recommendations
- Don’t execute Apache Taurus on the same machine where your application is running. This ensures that it does not waste resources that could be used by your backend application
- Don’t forget to specify the
content-encoding
- Understand the capabilities and functionalities of your chosen executor
- Consider the hardware and software limit of your client machine: If JMeter (HttpClient) is sending thousands of HTTP requests per second, the system could run out of available ephemeral ports for allocation and you would need to tweak the OS configuration.
This article is just a sneak peek with enough information to get started.
If you want to know more go to https://gettaurus.org/
Happy Testing!