Simultaneous HTTP GET Requests

22 06 2010

Some job-seekers complain about the interview process, comparing it to dating, saying that they would just like to be “married”, i.e. employed already. I in contrast look forward to the moment when I will sit down with a prospective employer and talk “turkey”, I mean techie. There’s always some delicious technical morsel that awaits my consumption. So, pass the gravy and I’ll tell you about yesterday.

I spoke with a lead PHP Developer who casually asked me whether I knew anything about the maximum number of http connections in a GET request that can occur simultaneously. The best I could do was to reply “Hmm, have yet to deal with this kind of an issue.” The interviewer informed me that the maximum number was two.

Now why is this technical information news to me? Probably it’s due to the nature of the projects I’ve been involved with to date.

So now that this question has arisen, let’s explore it in a little more in depth.

What is this restriction really about? It’s about the browser or another client application making multiple simultaneous http GET requests to a web server. So, why should there be a restriction? The restriction owes its existence to a suggestion someone made regarding the HTTP protocol, as follows in RFC 2616 8.1.4 Practical Considerations:

Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy … These guidelines are intended to improve HTTP response times and avoid congestion.

If you find RFC’s about as interesting to read as say watching CSPAN, you might like better Google’s explanation, at the following URL:

http://code.google.com/speed/page-speed/docs/rtt.html#ParallelizeDownloads

Bottom line: the RFC suggestion means two parallel connections per hostname, ie domain name.

All of the following URLs have interesting discussions on this topic, including a few tricks to get around the restriction:

http://www.openajax.org/runtime/wiki/The_Two_HTTP_Connection_Limit_Issue
http://weblogs.asp.net/scottcate/archive/2006/03/21/440740.aspx
http://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser
http://cometdaily.com/2007/11/11/the-dreaded-2-connection-limit/
http://stackoverflow.com/questions/2069562/2-connections-per-server
http://www.die.net/musings/page_load_time/

Of course, some of the above URLs are a little old (2006, 2007), so things could have changed since then and, indeed, they have! The google link above indicates that you can see what’s up with the newer browsers at:

http://www.browserscope.org/

If you click on browserscope.org’s “network” tab on its index page, you will then be able to clearly see, what is going on with the latest browers. From Android2.2 through Safari 4.0 and all the latest versions of Chrome, Firefox, iPhone and Opera, the range of multiple connections is anywhere from 4 to 8 depending on the browser. Even IE8 supports 6 multiple connections.

So, why did the interviewer insist on 2 being the maximum number of concurrent connections? Maybe his worldview is colored by IE7 which is restricted still to two. And, from a business perspective, perhaps he is right. If the majority of the users of his company’s products are using IE7, then two is the correct answer.

Users of Open Source browsers, on the other hand can enjoy the benefit of speedier page loads precisely because their browsers have disregarded the old-fashioned default of two connections. When they browse a webpage, their browsers will grab images and other resources at 4, 6 or even 8 at a time instead of merely 2. This is a boon for all who use open source technologies whether as users or developers.

This work is licensed under a Creative Commons License
.

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: