Max connections per IP #80

Closed
KimSchneider opened this Issue Jul 28, 2011 · 10 comments

Projects

None yet

2 participants

@KimSchneider

Hi,

we want to use the node-http-proxy in combination with express.

Our setup ist the following:

Main server:

  • express listening on port 443
  • node-http-proxy listening on port 84 and forwards to 443

Proxy server

  • node-http-proxy listeing on port 443 and forwards to main server port 84 or another tomcat server

Clients

  • clients connect to proxy server
  • depending on the url, they are routed to main server or tomcat server
  • if routet to main server the connection is kept open for about 30 seconds (long-polling)

Everything works fine if our clients connect directly to the main server. If they connect over the proxy server we can have 5 request and nothing else happens until those requests are closed.

We have to be able to connect a minimum of 500 clients by long polling. Any way we can manage this?

Thanks for your help.

@dominictarr

are you sure that this is caused by node-http-proxy?

there was recently a discussion on the mailing list about this topic: http://groups.google.com/group/nodejs/browse_thread/thread/bbc049d7d320c5ab?hl=en%3Fhl%3Den

@dominictarr

oh sorry, it might besomething to do with this: http://nodejs.org/docs/v0.4.10/api/all.html#agent.maxSockets

@dominictarr

okay, read through the code in node-http-proxy: https://github.com/nodejitsu/node-http-proxy/blob/master/lib/node-http-proxy.js#L32 default connections is set to 100.

you'll want to include:

require('http-proxy').setMaxSockets(500)

how are you generating the requests?

@KimSchneider

Thanks for your reply. I am not really sure, if it has to do with express. I already modified the http-proxy and hard coded the defaults to 10000 connections.

After some checks it realy seems to be limited to 5 connections. So, the max connections have no effect or express accepts only 5 connections, too. To be honest, I don't know how to set the max connections on express and did not find any solution, yet.

To answer your question, we have a c# client that talks to our online servers via https requests.

@KimSchneider

Found a solution, here you go: #84
:-)

@dominictarr

hi, how are you testing this?

I have not yet seen http-proxy limiting it self to 5 concurrent connections.

here in a test I am using, it does not respond until it has 10 connections, so if some thing is limiting connections to 5 then it would timeout.

but that is not the behavior that I am seeing.

can you run the test and tell me what happens?

@KimSchneider

I testet this using an basic node webserver that counts incoming connections, but does not close them. I started a proxy that forwards every request to the webserver.

Run jMeter or any other http stresstool with more than 5 concurrent threads. In my testcases everytime I used the proxy the counter stopped at 5 and if I did not use the proxy I have been able to open as many connections as I wanted.

My fix changed it to the behaviour we need :)

@dominictarr

oops, I forgot to link my test. https://gist.github.com/1119591

can you post your test as a gist so that I can reproduce the issue here?

@KimSchneider

https://gist.github.com/1120162

That's my testcase. Open it 10 times in your browser or run a http stress tool against it.

@dominictarr

thanks. I've reproduced your issue.

@dominictarr dominictarr added a commit that closed this issue Aug 2, 2011
@dominictarr dominictarr Merge branch 'patch-1' of https://github.com/KimSchneider/node-http-p…
…roxy

closes #80
Conflicts:
	lib/node-http-proxy.js
604ed28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment