Load testing is a type of performance testing that simulates a real-world load on any software, application, or website. This helps us understand how our system behaves under pressure and prepare it for production.
One of the open source tools that we can use to perform load testing on an HTTP server is autocannon. autocannon is a command line benchmarking tool written in Node.js.
There are scenarios in which performance testing and understanding the test results is easier if we can see them in a visual way.
autocannon-ui provides a GUI for using autocannon while preserving much of the same user experience and adding a few things on top of it.
autocannon-ui enables users to run various tests and receive the results, all on a single web page. The results can be easily understood whether you are an autocannon user or new to the world of load testing.
The user interface also provides the ability to compare two test results.
In this article we will take an in-depth look at how test execution works using various configuration parameters and how the comparison of two tests is done.
Using autocannon-ui
To start autocannon-ui you can simply execute the command npx autocannon-ui
in your favorite command line tool. This will open a new browser window, and the app will start on a free TCP port.
The picture below shows what the main user interface looks like:
As you can see there are several input elements to configure the URL of the target server, the HTTP method, the number of connections, pipelining and duration of the load test. These correspond to the main configuration options you can find in autocannon as well.
Sending requests and specifying the configuration options
Sending requests is easily done by pressing the RUN TEST button. Once the operation finishes, the results will appear on the page.
Basic configuration options
- Test URL – this is the endpoint that autocannon will hit. This is a required option.
- Method – the HTTP method (GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE, PATCH)
- Connections – the number of concurrent connections
- Pipelining – the number of pipelined requests for each connection
- Duration – the duration of the test in seconds
Advanced options
- Title – you can give your tests a title that you can later use to easily identify them
- Timeout – the number of seconds before timing out
- Headers – used to specify the HTTP request headers
- Body – used to set the request body
Below you can see an example of the advanced options and how to use them:
Tests results
If you got to this point you might have already run a couple of tests and seen the results. If you expand one of the results you will be able to find extra information about how the API endpoint performed by measuring:
- the response latency
- throughput
- the success rate of the responses and the details of each HTTP status
- what parameters were used to run the test
These values come from autocannon. autocannon-ui displays them in a tabular view.
Below you can see an example of such results:
Comparing tests using autocannon-compare
autocannon-ui also integrates with autocannon-compare. This allows us to compare two autocannon runs. To use this functionality, select two test results and press the Compare button. A popup will appear which will contain the comparison results.
Below we can see an example of the results of this feature in action:
The autocannon-compare documentation contains information about the comparison results.
Check it out!
In this article, we’ve looked at what autocannon-ui is and how it can be used to help you measure the performance of your HTTP services. With autocannon-ui you can measure the health of your API endpoints and test your changes by comparing them to detect their impact on performance, before reaching production.
autocannon-ui brings a new light into performance and load testing by allowing users to visually analyze their endpoints and apply the optimal changes they need to obtain a reliable, fast and optimal service.
As with many of our projects, autocannon-ui is an open source tool built on top of other open source tools such as autocannon and autocannon-compare.
Happy load testing!