Microsoft launches major new Content Distribution Network that can add AJAX features to any website
Microsoft has just announced a useful new CDN service that any website can use, at no cost, to add rich JavaScript functionality and Ajax.
This move by Microsoft is a big deal. It’s an important milestone in the evolution of mainstream web architecture. The new service will influence the way in which many websites and many web developers work -- forever.
Web developers can start using the new service right now. It provides hosting for super-fast optimised delivery of static assets such as JavaScript -- including the JQuery and ASP.NET AJAX libraries. A key advantage of a CDN is it that can serve the assets much faster than most web sites would, meaning web pages load much faster.
The service is free to use and open to everybody. It’s a convenient way to reference JavaScript files. You don’t need to use Microsoft development tools to take advantage of JS libraries. However, Visual Studio does make it so much easier to develop JavaScript and Ajax web applications, with seamless integration of JS libraries with the development environment, providing powerful features like drag-and-drop web development in design view and code view, and IntelliSense predictive code auto-completion when coding by hand, etc. ASP.NET developers get built-in CDN support through the EnableCdn attribute of the ScriptManager control.
The ASP.NET AJAX library is often overlooked by developers who don’t specialise in Microsoft technology, but it’s a very useful resource that everybody can use. I hope the CDN will tempt more web developers and user-experience designers to see what’s on offer. Microsoft has packed some really useful features into its JS libraries, offering impressive features such as seamless support for the back/forward buttons of the web browser out-of-the-box. If you’ve used Live Mail lately (formerly Hotmail), you’ve probably seen it in action already. For example, if you click on an email in your Live Mail inbox and then click the browser’s back button, Microsoft's JS magic automatically ensures that you return to the inbox in exactly the same way as you would if the web site did not use Ajax. It’s a flawless user experience, yet this type of capability is still not common on Ajax web pages, and historically this type of functionality has not been easy to implement.
Top 3 advantages of using a CDN to host JavaScript
- The request will be processed much faster than if it had to hit your web-server (making the end-user's page load much faster)
- The script can be easily cached across multiple web-sites – which means it might not even need to be downloaded if the user has already hit a web-site that requested the file (and as such has it already in the browser's cache)
- You don't have to pay for the bandwidth of this file – since the file comes from our server we pay the bandwidth cost (saving you money)
Examples of HTML to reference JavaScript libraries on Microsoft's AJAX CDN
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjax.js" type="text/javascript"></script>
16 September 2009
Tags: microsoft ajax cdn content distribution network jquery javascript libraries js files library static assets asp.net
Comments: 8
Add Comment
I just want to emphasise that it's ideal, and indeed widely considered best-practice, to host static assets in a way that is optimised for the purpose, typically on a separate domain, with far-future expiry headers, no cookies, minimising HTTP overhead and maximising performance.
Simpson's did it!
Oh, wait, no... it was Google.
http://googleajaxsearchapi.blogspot.com/2008/05/speed-up-access-to-your-favorite.html
Oh, and Yahoo!
http://developer.yahoo.com/yui/articles/hosting/
I would happily use JS URLs served by Google's or Yahoo's infrastructure... I would certainly be interested in trying some benchmarking from here in London to see if they perform as well as Microsoft's new CDN...
However, unfortunately, neither Google or Yahoo include the ASP.NET AJAX library, which is actually really useful. I don't know why these companies omit Microsoft's mainstream JS library. Perhaps it's for commercial reasons (that would be characteristically anti-competitive). Perhaps some of the folks at these companies are unable to get over the anti-MS chip on their shoulder.
(Google launched their JS library CDN last year, and have not yet included Microsoft's JS libraries. Yahoo launched their JS hosting service the previous year for YUI, but neglected to offer an option for JQuery and Microsoft's JS libraries.)
Download speed
Microsoft's JavaScript URLs perform slightly faster than Google's here in London in the UK. I'd be interested to hear how the two CDNs compare in other geographic locations.
To compare the relative performance of Microsoft's and Google's CDNs, I executed a simple benchmarking test. The average time taken to download the JQuery 1.3.2 JavaScript file once was 777.1 ms from Google and 320.8 from Microsoft. The average is calculated from the results of ten separate identical downloads. The raw data is provided below.
I also measured the average time taken to download the file ten times as rapidly as possible (in a for loop), repeating this test ten times and calculating the mean time taken to serve ten rapid consecutive downloads. Google completed the test in 1077 ms on average, with a fastest recorded time of 937 ms. Microsoft completed the test in 1015 ms on average, with a fastest recorded download of 749 ms.
Time taken to download raw JQuery JavaScript file (milliseconds).
These tests were performed out over a standard commercial leased line (20 MB symmetric, uncontended) in London. Later I’ll try it over a standard fibre-optic cable broadband connection (up to 20 MB down).
Notes
http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js (57.9 kb)
http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js (55.9 kb)
http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.js (124 kb)
http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js (117 kb)
http://www.asp.net/ajax/cdn/#2
http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery
Update
Last night Microsoft's social web guy, James Senior, asked me for the raw data from my comparison of Microsoft's Ajax CDN with Google's. It's for a Microsoft white paper on web platform performance which he's he's writing. (You may be familiar with Senior's original blog on Technet.)
I ran a simplified version of the test, and posted the results on my SkyDrive. I also uploaded a C# code example in the same folder, in case this is useful to anybody wanting to run similar tests.
In last night's test, I simply sent HTTP requests at 10 second intervals and measured the time taken to receive the whole JavaScript file for the latest version of the JQuery library. I used a random query string to prevent caching. Obviously download speed can vary greatly with time and location, but these are my results here in London, in the South East of England.
My results are conclusive: Microsoft's Ajax CDN delivered the JavaScript file more than twice as fast as Google's.
It's worth noting that ASP.NET Ajax will become less important in the future, with JQuery being Microsoft's preferred JavaScript library. We already have seamless JQuery integration in Visual Studio for for ASP.NET web development. MS will increasingly be contributing to the JQuery project, as announced at Mix10. I welcome this direction for Microsoft! :) [Full credit to James Senior who kindly emailed me about this yesterday.]