Benchmarking HTTP requests
As we’ve seen throughout this book, HTTP communications are the foundation of many Node.js applications and microservices. For these applications, the HTTP requests should be handled as efficiently as possible. To be able to optimize, we must first record a baseline measure of our application’s performance. Once we’ve recorded the baseline, we’ll be able to determine the impact of our optimization efforts.
To create a baseline, it’s necessary to simulate the load on the application and record how it responds. For an HTTP-based application, we must simulate HTTP requests being sent to the server.
In this recipe, we’ll capture a baseline performance measure for an HTTP web server using a tool named autocannon
(https://github.com/mcollina/autocannon), which will simulate HTTP requests.
Getting ready
In this recipe, we’ll be using the autocannon
tool to benchmark an Express.js web server. Instead of...