A Novice’s experience with Load Testing using Autocannon
Puppeteer?is one of the most common libraries used for generating pdfs. In general, the steps involved are for every pdf generation request:
We wanted to skip the launching and closing part for every request by opting for a dedicated puppeteer server and keeping it up and running. Then, connect to that server and generate pdf and disconnect.
Now, we wanted to observe the load it could handle and understand how CPU and memory usage grow with the increase in load. For this, we decided to do a load test. There are many tools for load testing like Artillery, JMeter, Autocannon etc. We chose to use?Autocannon?for load testing.
Server load testing and benchmarking are essential to understand how many requests a server can fulfil successfully at the same time.
Autocannon is a?HTTP/1.1 benchmarking tool written in Nodejs.?It also supports?HTTP pipelining.
Installation
Load Test Your Sever
We can run it directly from command line
we can also run it programmatically. Here is a sample code you can use for your reference.
领英推荐
In the above code snippet, a post request is being sent. We can add connections and the duration(the time it will execute) according to our requirements. By default, 10 concurrent connections are made, executing for 10 sec. The requests is an array of requests e.g.,
After the execution, the output looks like below:
Here are the meanings of the few terms that we see in the result-:
For a detailed reference, read —?Autocannon. These data help in evaluating the performance of the application.
Limitations
Conclusion
Load testing is essential in the Software Development Lifecycle. It not only evaluates how the performance of an application can be affected by average and peak loads but also simulates real user scenarios. Therefore, load testing should be a part of the strategy to make software applications more efficient, effective, performance-oriented, and consumer-driven.
? Thank you for reading and I hope you find it helpful. I sincerely request your feedback in the comment’s section.
- Princy Gupta (Tech team, Powerplay)