Simplifying HTTP Benchmarking with Node.js Frameworks Using wrk

Aug 2, 2024 | Programming

Welcome to the ultimate guide for performing simple HTTP benchmarks using the wrk tool across various Node.js frameworks. HTTP benchmarking helps assess the performance of your server, and with the help of the right tools and frameworks, you can achieve impressive insights into how your applications are handling requests.

Prerequisites

Before diving into the benchmarking process, ensure you have the necessary tools installed. You will need:

  • wrk – A modern HTTP benchmarking tool.

Installation

To get your benchmarking environment up and running, follow these installation steps:

  • Clone the benchmark repository using Git:
  • git clone git@github.com:hbakhtiyornode-frameworks-benchmark.git
  • Navigate into the directory:
  • cd node-frameworks-benchmark
  • Install dependencies using Yarn:
  • yarn install

How to Run the Benchmark

Running the benchmark is a breeze. It automatically executes after the Yarn installation. You can simply execute the following command:

make

Once the make tasks are finished, check the benchmarks.txt file or monitor your console output for results!

Benchmark Results

The benchmarking results provide performance insights depending on the type of HTTP connection made. Below are two types of tests conducted – one with close connections and another with keep-alive connections.

Without Measuring CPU Memory Usage (Close Connection)

Framework Requests/sec
ukoa.js20220.47
ufeathers.js13594.83
uexpress.js12812.89
totaltotal.js4204.16
rawnode.js3043.56
feathers.js2365.02
koa.js2242.12
micro.js1784.28
express.js1698.33
restify.js1443.69
hapi.js512.29
uws.js158.26

With Keep-Alive Connection

Framework Requests/sec
uws.js54232.14
ukoa.js21036.52
ufeathers.js13547.05
micro.js13213.85
uexpress.js12514.36
rawnode.js12427.84
totaltotal.js8597.81
koa.js7594.78
express.js5600.86
restify.js4775.49
feathers.js2959.22
sails.js1215.46
hapi.js1077.86

System Hardware and Software Information

  • CPU: Intel® Core™ i3-2310M @ 2.10GHz × 4
  • RAM: 4GB
  • Node Version: v7.9.0
  • OS: Ubuntu 17.04 LTS x86_64
  • Kernel: 4.10.0-20-generic

Additional Notes

Some frameworks are bundled with the uWebSockets server. The benchmarks run for a duration of 5 minutes, leveraging 12 threads, while maintaining 400 HTTP connections open.

Troubleshooting

If you encounter any issues while running the benchmark, consider the following troubleshooting steps:

  • Ensure that all dependencies are correctly installed and up to date.
  • Check if wrk is installed correctly by running wk -V to check version.
  • If you do not see output or benchmarks, re-run the make command and carefully observe terminal messages.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

By following this guide, you should be well-equipped to set up and conduct HTTP benchmarks across various Node.js frameworks. Remember that since different frameworks have different strengths and weaknesses, the results may vary based on the specific use cases and configurations you apply.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox