Welcome to AspAdvice Sign in | Join | Help

ASP.NET AJAX Download Performance Improvement Request

I'm a big fan of ASP.NET AJAX in general, but one concern I have and something that has forced me to use other technologies is the size of the library.  It's about 85kb when compressed and unfortunately that is quite large if you're trying to include it on most every page on a site (or, much much worse, every advertisement in a large Microsoft developer advertising network).  One can certainly argue that this will be cached, and that is true, but for many sites that get most of their traffic from search engines (ASPAlliance gets over 70% of its traffic from this), you have to assume that many users will not have the .js file cached, and that is a significant increase in the total page size.

I would like to suggest (and have done so previously, but less publicly) that it would be a good thing if the ASP.NET AJAX javascript library were hosted by Microsoft as an option.  This would involve some slight changes to the coding (specifically I would add a property to the <ScriptManager> control to enable using the Microsoft provided library), and would require that Microsoft make a commitment to having the .js file available via their infrastructure.  In practice this would not be very different from the distribution model that they are currently using for Silverlight deployment, but would be much smaller (per file - 85kb vs 4mb).

The chief advantage of this approach would be a huge reduction in the number of downloads of the AJAX javascript file required for clients, and an increase in performance across the board as a consequence.  The likelihood that any given browser would have a cached version of the AJAX javascript would be much higher if a large number of AJAX-enabled sites referenced the Microsoft hosted AJAX library.  The cost (in bandwidth) to use AJAX would go down.  The performance for all AJAX-enabled web applications would go up.  Clients that do not wish to cede control of the distribution of the download could continue hosting the files themselves without any change.  The change in behavior of ScriptManager could easily be rolled out in an SP or as part of vNext, and would make AJAX more attractive when compared to alternate (lighter weight) JavaScript frameworks such as jQuery.

Sponsor
Published Tuesday, April 15, 2008 2:38 PM by ssmith
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: ASP.NET AJAX Download Performance Improvement Request

Although "lighter" than the MS AJAX library, I wouldn't call jQuery "light."  Regardless, this is an excellent idea that would benefit sites that use the library and remove an obstacle (for some) in adopting it.  A Versioning scheme would need to be worked out, but there is very little downside to it (besides the increased bandwidth costs, if there are any, incurred by MS.)

Tuesday, April 15, 2008 4:11 PM by Carl

# re: ASP.NET AJAX Download Performance Improvement Request

I completely agree with you.  I was more or less forced to use Mootools with JQuery just because the generated scripts of the MS Ajax library and the Ajax toolkit were just huuuuuuuuuge.  Even worse, I've noticed, that they script files don't always get cached (even on the same browser).  Is that due to the way they're generated dynamically by a HTTPHandler??

Either way, I haven't looked back after switching to JQuery.  MS Ajax is cool but it's bulky size doesn't make it a good option for Internet sites (just fine for Intranet though).

Tuesday, April 15, 2008 5:18 PM by Arash Homayounpour

# re: ASP.NET AJAX Download Performance Improvement Request

I agree.

My todo list includes removing ASP.NET AJAX from one of my public-facing sites soon.  It kills the initial load speed for the site, reducing my quality score in various ad networks and increasing the bounce rate of impatient first time visitors.

If I could deploy ASP.NET AJAX backed by a Microsoft CDN, it would suddenly be much more competitive against something like jQuery.

@Arash:  Make sure you have the ScriptManager's ScriptMode=Release, and have this line in your web.config:

<scriptResourceHandler enableCaching="true" enableCompression="true" />

Tuesday, April 15, 2008 6:25 PM by Dave

# re: ASP.NET AJAX Download Performance Improvement Request

I wonder how quickly Microsoft would come around and make the change to host it if someone else started hosting it... like say Google?

Tuesday, April 15, 2008 10:25 PM by Erik

# re: ASP.NET AJAX Download Performance Improvement Request

Great idea.  Yahoo does this with their code library, and they maintain strict version numbers for each release -- and keep them all available.  So even if the code gets updated -- and it frequently does -- nothing breaks on the web, since every web page links to a version of the code.

Tuesday, April 15, 2008 11:56 PM by Speednet

# Interesting Finds: April 16, 2008

Wednesday, April 16, 2008 10:17 AM by Jason Haley

# re: ASP.NET AJAX Download Performance Improvement Request

Will this not result in a cross-site-scripting security issue?
Thursday, April 17, 2008 7:36 AM by Peter

# re: ASP.NET AJAX Download Performance Improvement Request

@Peter,

 Yes, it will not result in a xss issue.  There are plenty of sites out there that host JS files from other locations - look at Google Analytics and just about every advertising platform out there, including Lake Quincy Media's.  And as others have mentioned, several other third party javascript libraries follow this design already, including Yahoo.  What issue, specifically, do you anticipate?

Thursday, April 17, 2008 4:17 PM by ssmith

# Improved Search Engine Placement

Increasing traffic to your website should be the first priority of eveyrthing.

Saturday, April 19, 2008 4:29 PM by Improved Search Engine Placement

Leave a Comment

(required) 
required 
(required) 
Enter the code you see below