Atlas 4: Only 2 calls at a time and don't expect any order

Browsers make 2 concurrent AJAX calls at a time to a domain. If you make 5 AJAX calls, browser is going to make 2 calls first, then wait for any one of them to complete and then make another call until all remaining 4 calls are complete. Moreover, you cannot expect calls to execute in the same order as you make the calls. Here's why:

Here you see, call 3's response download is quite big and thus takes longer than Call 5. So, Call 5 actually gets executed before Call 3.

So, the world of HTTP is unpredictable.

Published Sat, Sep 23 2006 17:37 by omar
Filed under:

Comments

# re: Atlas 4: Only 2 calls at a time and don't expect any order

Tuesday, November 28, 2006 3:36 AM by Michael Schwarz

Look at my blog where I'm writing about mistakes in AJAX applications. You should never run more than one request at the same time. Not only AJAX requests are queued because of the 2 concurrent http connections restriction, think on mouseover images!

Michael

# re: Atlas 4: Only 2 calls at a time and don't expect any order

Wednesday, December 13, 2006 8:27 AM by Rachit

Is there anyway to increase the concurrent http connections limit? What are the down side of it if we increase it? Anyways, it's bad idea to call more than 2 requests at a time but when you deal with long running webservices (which takes more than 2-3 seconds), I wonder what else can be done!

# re: Atlas 4: Only 2 calls at a time and don't expect any order

Wednesday, December 13, 2006 5:25 PM by Al Borns

The behavior comes from a limitation within WinInet and as far as I know there is no fix, except using another component ;-)

# re: Atlas 4: Only 2 calls at a time and don't expect any order

Thursday, December 14, 2006 11:16 AM by Marijn Ros

As far as I know, a 2 connection limit is suggested in the HTTP/1.1 specification.

I think it can be raised by the user through a registry setting, but there is a reason for setting it to 2: it is a balance between network load and webserver load combined with the fact that using 1 connection would show the stalls all the time, while with 2 there is at least a way to bypass a large request.

Marijn

BTW: Opera has the connection limit set higher ( 4 or 8, I do not remember), Firefox also defaults to 2 (for HTTP/1.1, I think it is 4 for HTTP/1.0)

BTW2: Using HTTP pipelining, at least the start can coincide with a previous download

# re: Atlas 4: Only 2 calls at a time and don't expect any order

Thursday, December 14, 2006 11:36 AM by Jonathan Gill - AMD

You should be able to make more than two calls on a web page at a time by using subdomains (e.g. calling images.pageflakes.com), be careful about security errors with any  Javascript though.  Caleb Jenkins from Microsoft can/will confirm this.

# re: Atlas 4: Only 2 calls at a time and don't expect any order

Saturday, December 16, 2006 6:34 PM by jayson knight

See my post here on how to raise the 2 concurrent request limit: http://jaysonknight.com/blog/archive/2004/06/04/277.aspx

Main post is for IE, there is a comment on how to do it in FF.

Leave a Comment

(required) 
(required) 
(optional)
(required)