Dan
Dan

Reputation: 3756

What is the maximum simultaneous HTTP connections allowed on one machine (windows server 2008) using python

To be more specific, I'm using python and making a pool of HTTPConnection (httplib) and was wondering if there is an limit on the number of concurrent HTTP connections on a windows server.

Upvotes: 4

Views: 5872

Answers (2)

Mr_Pink
Mr_Pink

Reputation: 109404

Per the HTTP RFC, a client should not maintain more than 2 simultaneous connections to a webserver or proxy. However, most browsers don't honor that - firefox 3.5 allows 6 per server and 8 per proxy.

In short, you should not be opening 1000 connections to a single server, unless your intent is to impact the performance of the server. Stress testing your server would be a good legitimate example.


[Edit]
If this is a proxy you're talking about, then that's a little different story. My suggestion is to use connection pooling. Figure out how many simultaneous connections give you the most requests per second and set a hard limit. Extra requests just have to wait in a queue until the pool frees up. Just be aware than a single process is usually capped at 1024 file descriptors by default.

Take a look through apache's mod_proxy for ideas on how to handle this.

Upvotes: 3

ThomasH
ThomasH

Reputation: 23516

AFAIK, the numbers of internet sockets (necessary to make TCP/IP connections) is naturally limited on every machine, but it's pretty high. 1000 simulatneous connections shouldn't be a problem for the client machine, as each socket uses only little memory. If you start receiving data through all these channels, this might change though. I've heard of test setups that created a couple of thousands connections simultaneously from a single client.

The story is usually different for the server, when it does heavy lifting for each incoming connection (like forking off a worker process etc.). 1000 incoming connections will impact its performance, and coming from the same client they can easily be taken for a DoS attack. I hope you're in charge of both the client and the server... or is it the same machine?

Upvotes: 3

Related Questions