Re: Maximum simultaneous NSURLConnections?
Re: Maximum simultaneous NSURLConnections?
- Subject: Re: Maximum simultaneous NSURLConnections?
- From: Greg Herlihy <email@hidden>
- Date: Wed, 15 Mar 2006 19:42:56 -0800
- Thread-topic: Maximum simultaneous NSURLConnections?
When connecting to a public HTTP server, a client should not maintain more
than two open connections to that server at one time. (RFC2616 ยง8.1.4) An
HTTP server is likely to impose its own limit on the number of simultaneous
connections from a single IP address anyway. Furthermore opening a large
number of simultaneous connections to a server may be seen as a denial of
service (DOS) attack upon the server.
Queuing HTTP 1.1 requests on a single, asynchronous connection such as
NSURLConnection is likely to offer the best throughput anyway - since both
the requests and the responses can be "pipelined" (sent back to back without
any pause between them). Furthermore, an asynchronous connection makes the
most effective use of the client's processor cycles; because it allows the
client to perform local processing (such as parsing HTML) more or less
continuously - and be interrupted only when data is available.
Generally, most HTTP requests are I/O bound - so transferring the data from
the server to the client's machine in the shortest amount of time achieves
the best performance. Client "load balancing" can only interfere with that
goal. And in fact a client has no reason for balancing the load of its
requests - because unlike a server - it can (and should) simply limit how
many outstanding requests it has to deal with at any one time.
Greg
On 3/15/06 2:50 PM, "John Pannell" <email@hidden> wrote:
> Hi all-
>
> I know there must be an answer to this, but I've yet to find it... is
> there a way to determine the maximum number of simultaneous
> NSURLConnections an application can keep open at one time? Is it
> akin to the max number of UNIX file descriptors? Is the max my app
> can create impacted by NSURLConnections active in other apps running
> at the same time? Are there any recommendations for determining how
> many to open at once?
>
> What I'm trying to achieve is internal load balancing between the
> resource identifying, html parsing, and resource fetching behaviors
> or my application. If I knew how many total connections I could/
> should keep open at once, I could then distribute them appropriately
> based on the size of the queued up requests for each behavior. It
> seems the OS is happy to queue things up no matter how many
> connections I allocate, but I would prefer to prioritize internally
> rather than make all requests stand in the same line.
>
> Any light that can be shed on this is much appreciated!
>
> John
>
>
>
> John Pannell
> Positive Spin Media
> http://www.positivespinmedia.com
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden