5

I wrote an express app with a single route. The handler saves the incoming request's body to a couchdb database.

I wrote a C# client app that sends 10000 small requests asynchronously using threads. Some of the requests fail with this exception message "No connection could be made because the target machine actively refused it".

I suppose this is because the node process reaches the max number of queued connections. Is that right?

This app is a proof of concept and I will not have such a big load in my real app but I want to tests the limits and understand how they work.

I have two questions:

  • Is there a way to control the max number of queued requests? Can I set it to "unlimited"? If not, what is the maximum and why is there a maximum?

  • In my node application, is there a way for me to catch and log those dropped requests? In a production app, I'd want to know that my server has reached the max number of requests.

More Info:

  • I'm running this on Windows
  • I have tried app.listen(3001, 'localhost', 10000) to set the backlog parameter. Same result.
Sylvain
  • 19,099
  • 23
  • 96
  • 145

1 Answers1

1

I think you are looking for the backlog setting. The default is 511. http://nodejs.org/api/net.html#net_server_listen_port_host_backlog_listeninglistener

Robert Peters
  • 3,814
  • 1
  • 17
  • 9
  • I already tried that. Setting it to 10000 did not change anything. – Sylvain Oct 11 '12 at 18:50
  • check out this. http://blog.caustik.com/2012/04/06/node-js-scalability-testing-with-ec2/ the file handle limit also seems to be an issue. – Robert Peters Oct 11 '12 at 19:11
  • Interesting… I'm running this on Windows and the following links make it unclear whether there is such a limit on Windows. See http://stackoverflow.com/questions/729162/windows-equivalent-of-ulimit-n and http://stackoverflow.com/questions/870173/is-there-a-limit-on-number-of-open-files-in-windows. I searched for 'max socket connections windows'. I found out about the registry setting MaxUserPort for which the default value (and the maximum value) on Windows 7 is 65534. I certainly don't reach that. – Sylvain Oct 11 '12 at 21:30