What is the performance for Node.js' http.requ

2019-02-13 08:53发布

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.

1条回答
来,给爷笑一个
2楼-- · 2019-02-13 09:21

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.

查看更多
登录 后发表回答