Ajax and double buffering.. - Raj Kaimal

Ajax and double buffering..

As I look at the new www.live.com interface, a thought came to my mind. I think it would be cool if the very first time an Ajax application is loaded, the web server would collect all the information from whatever different sources (which can be cached on the webserver) and send it down instead of having different content areas that make individual requests while displaying "Loading...".

This gives the appearance of a page that loads faster. Similar to the concept of double buffering.

The images, Css etc will obviously still be seperate requests the first time and will be pulled from the browser cache on subsequent requests.

Some other things:

  • www.live.com makes ≈ 300-340 requests just to load the homepage with a cleared cache. This is including all css, js, images and the content.
  • Google Personalized Homepage makes ≈ 16 requests
  • my.yahoo.com makes ≈ 84 requests

    These will vary according to how many content areas you have.
  • www.msn.com makes ≈ 45 requests

We know RFC 2068 states that:
Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD maintain AT MOST 2 connections with any server or proxy.

So by "double buffering", we might be able to reduce the number of requests and give the appearance of a faster loading page. On the other hand, as connections become faster, this might not be an issue at all.

Thoughts anyone?

 

Published Wednesday, March 08, 2006 10:26 PM by rajbk
Filed under:

Comments

# re: Ajax and double buffering..

So you mean instead of doing 300 small requests, just do one big one? That would make a whole lot of sense to me.

Especially when you think the HTTP header may be 100 bytes or so, if the requested data isn't much bigger than that, then you're just wasting all that extra overhead.

Thursday, March 09, 2006 12:07 AM by Dean Harding

# re: Ajax and double buffering..

I can't tell you what our site is until it's released on Monday, but I CAN tell you that our architecture is something similar to what you're talking about. Well, we at least get rid of having soooo many requests on the first load.

http://on10.net

That's just a teaser site for now. Watch for the real thing to go live on Monday (the 13th).

Basically, what we did was make it so that our web services just render asp.net controls and send back the html. This works great for our ajax stuff, but when the page loads, it's just renders those controls instead of making ajax calls, so basically just the css files, js files, images and html comes down and that's it.

The only downfall to this is that the server does more work instead of sending some of the work down to the client, but we've found that this method works out really well and I can pretty much promise that the number of requests that happen on our site will be a lot less than all the sites you listed. And no, if you're trying to guess what our site is all about, it's not really anything like the sites you listed.

Check back on my blog and the on10 site for more next week. :)

Thursday, March 09, 2006 12:54 AM by Erik Porter

# re: Ajax and double buffering..

If you analyze the requests closer, you will notice that the majority of the small requests are images (e.g., dropping images, there are about 30 requests for the initial state of the page). Also, due to temporary caching issues, the majority of the images are requested multiple times.

However, your point is well made and we are still "experimenting" with finding the best balance. On the latest windows live release, the Live.com team included the initial user state directly on the page. As a pattern, we are also exploring how to batch smaller data requests (in addition to potentially including more data directly in the page).

I expect we will continue to tweak our approaches to find the best balance for our scenarios to provide the best overall experience (balanced between initial load and subsequent visits), intelligently leveraging the 2 connection limit (including splitting content across servers), and leveraging the caching benefits of the client.

For example, while the initial load time may be longer, with smart caching and properly aging data requests, subsequent usage can potentially be much faster as you only need to load the differential.

There are a few other trade-offs for both approaches to consider, but this is an interesting discussion where I believe there is no single universal answer.

Thursday, March 09, 2006 6:04 PM by Scott Isaacs (Windows Live)

Leave a Comment

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