Benchmarking HTTP requests
As 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 will be able to determine the impact of our optimizations.
To create a baseline, it is necessary to simulate the load on the application and record how it responds. For an HTTP-based application, the simulation of HTTP requests sent to the server is required.
In this recipe, we will be capturing a baseline performance measure for an HTTP web server using a tool named autocannon
(https://github.com/mcollina/autocannon) to simulate HTTP requests.
Getting ready
In this recipe, we will be using the autocannon
tool to benchmark an Express.js web server. Instead of creating a web server from scratch, we&apos...