Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the performance for Node.js' http.request ? How many concurrent request it can handle?

My node.js server is making a call to another server using the latest (0.4.8) http.request call.

I use jMeter to run load testing. with 50-100 concurrent threads per sec, and loop 1000 times.

I observe some slow down when script keeps running. I monitor the network throughput is pretty low, CPU & memory are low too. And in the other server, the log shows that their response is quick. (within millisecond).

however, the console.log in my node.js server shows that the http.request response time begins with 200-300 ms, to 2000-3000 ms.

I'm not sure if there is a limit of concurrent http.request I can make.

please advise.


After tremendous testing, I think the average is about 300-400 request / sec for http.request with a ok server, maxSockets = 1024. Usually, I see the speed (connect to different website) is about 80-100 ms per request.

like image 625
murvinlai Avatar asked Feb 03 '23 17:02

murvinlai


1 Answers

The max concurrent connections should depends on your hardware. This article said node.js can support tens of thousands of concurrent connection. However, most linux systems only allow you open 1024 files/sockets on same time by default. For that case, you can run as root and then set ulimit as a big number(e.g., 100000), then run a stress test with your hardware for getting the accurate capacity of concurrent connection.

like image 186
sky100 Avatar answered Feb 05 '23 15:02

sky100