[nodejs] node.js response time increase with concurrent connections

1,770 views
Skip to first unread message

jason.桂林

unread,
Aug 23, 2012, 1:34:31 AM8/23/12
to nod...@googlegroups.com

test by node.js http helloworld 

10 concurrent connections
response: 0ms(min) 19ms(max) 1ms(avg)

30 concurrent connections
response: 2ms(min) 20ms(max) 4ms(avg)

100 concurrent connections
response: 7ms(min) 43ms(max) 15ms(avg)

1000 concurrent connections
response: 6ms(min) 212ms(max) 167ms(avg)


We can see that, node.js response time increased with concurrent connections, any one can explain this?

And how to avoid this problem, and if it is not http but tcp, will it be an critical issue for multi player online game server, there will be many concurrent connections.

--
Best regards,

桂林 (Gui Lin)


Yi Tan

unread,
Aug 23, 2012, 1:44:33 AM8/23/12
to nod...@googlegroups.com
use cluster:  http://nodejs.org/api/cluster.html

Regards,

ty


2012/8/23 jason.桂林 <gui...@gmail.com>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

hd nguyen

unread,
Aug 23, 2012, 6:43:24 AM8/23/12
to nod...@googlegroups.com
As Yi Tan suggested, using cluster to utilize multicore server should be better.

On Thu, Aug 23, 2012 at 12:37 PM, Hitesh Joshi <hitesh....@gmail.com> wrote:
I don't think this is a problem. Problem should occur when the response time is in SECONDS like 3-4 second.

I really think nodejs can handle millions of concurrent users on a good server.

Read this , http://blog.caustik.com/2012/04/10/node-js-w250k-concurrent-connections/
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en



--
Nguyen Hai Duy
Mobile : 0914 72 1900
Yahoo: nguyenhd_lucky

Ben Noordhuis

unread,
Aug 23, 2012, 6:51:41 AM8/23/12
to nod...@googlegroups.com
On Thu, Aug 23, 2012 at 7:34 AM, jason.桂林 <gui...@gmail.com> wrote:
> test by node.js http helloworld
>
> 10 concurrent connections
> response: 0ms(min) 19ms(max) 1ms(avg)
>
> 30 concurrent connections
> response: 2ms(min) 20ms(max) 4ms(avg)
>
> 100 concurrent connections
> response: 7ms(min) 43ms(max) 15ms(avg)
>
> 1000 concurrent connections
> response: 6ms(min) 212ms(max) 167ms(avg)
>
>
> We can see that, node.js response time increased with concurrent
> connections, any one can explain this?
>
> And how to avoid this problem, and if it is not http but tcp, will it be an
> critical issue for multi player online game server, there will be many
> concurrent connections.

Your post omits crucial details, like on what OS you tested it, on
what kind of network, with what tool, what the tool's settings were,
etc.

All one can say by the numbers posted is that the response time seems
to scale linearly - which isn't all that bad, really.

Murvin Lai

unread,
Aug 23, 2012, 8:58:44 PM8/23/12
to nod...@googlegroups.com
this is normal because you are running with default 1024 open file limit.

As the socket pool is limited to 1024 sockets, and you have 1000 concurrent requests, requests will be accumulated in the socket queue and thus, have to wait unitl other requests are done from the pool and released.

easy way is to change the /etc/security/limits.conf file and increase the open file soft/hard limit.   Once you increase that, you will be fine with 1000 concurrent requests.

but there are other factors and will overwrite the limit.  please see my website for tips... murvinlai.com


Matt

unread,
Aug 23, 2012, 11:25:49 PM8/23/12
to nod...@googlegroups.com
This is not a correct response. If you hit the open file limit usually node will crash (unless you protect against that). It won't ever slow down because of it. And it won't ever just pause connections until the limit is lowered. It will throw an error or an exception.

桂林

unread,
Aug 23, 2012, 11:30:29 PM8/23/12
to nod...@googlegroups.com
Anyone argue with this can make a test on it.

I am test on MacOSX, benchmark tool is write in node.js.

Matt

unread,
Aug 23, 2012, 11:30:25 PM8/23/12
to nod...@googlegroups.com
Nobody is arguing with it. You're saying response time increases linearly with load... That's... great.

darcy

unread,
Aug 26, 2012, 10:09:14 PM8/26/12
to nod...@googlegroups.com
if your server has reach the cpu upper limit(cpu idle approach 0%) with n clients, then the response time will increase with the client number linear.

Murvin Lai

unread,
Aug 27, 2012, 6:56:51 PM8/27/12
to nod...@googlegroups.com
I'm not arguing or anything, but that's what I observed and recorded during load testing.  Not just once but load testing over weeks, conducted by not just me but a whole team of developers.  

Node.js itself will not crash if hitting open file limit, but some sockets will hang up, and response get slower, etc.

No matter what, one of the solutions is to increase the open file to ...e.g. over 10K.   then you will be safe in most cases.   




Reply all
Reply to author
Forward
0 new messages