Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max connections per IP #80

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

Max connections per IP #80

KimSchneider opened this issue Jul 28, 2011 · 10 comments

Comments

@KimSchneider
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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

@dominictarr
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@dominictarr
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor

thanks. I've reproduced your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants