Mon 5 May 2008
AOL CDN FTW
Posted by Aaron under Dojo, Web
[4] Comments
So lately I've started undergoing (yet another) personal project. Basically a file request and upload system that will be using the Dojo Grid. Initially I was going to try using a few other widgets from the Dojo family, but decided that it was time to revisit the Grid and see how much it has progressed since Dojo 1.0.2.
Initially when I was using it, I couldn't understand why my page was loading so slow. When I slow, I mean slow; enough to the point that the browser would give you the whole this page could be doing bad things, would you like to stop scripts on this page? slow. Yeah I have a few XHR's here and there, but nothing out of the ordinary. The only thing I could find was that commenting out Dojo requires for the actual Grid dijit improved performance immensely, but how am I supposed to use a grid if I can't include it! I didn't really remember Dojo's demo being slow at all, so I went to investigate on their site.
Copying their example line-for-line worked like a charm. It loaded up nice and quick, no problems, no lag and none of it was my code. So I began to tweak a few things to try and get my data in the grid. First off, I noticed that they were making their includes from the AOL CDN. I've heard about this but never really looked that much into it (as I probably should have). So I took it out, and replaced it with includes from our DreamHost server. Upon doing that, and reloading, this is where the slow down was from.
Don't get me wrong, DreamHost is a great hosting company, but lets face it - you get what you pay for. $90 for two years of hosting, you can't really expect to get lightning fast connections and/or a dedicated machine as your server. Their notorious slow load times had to be the bottleneck that was killing my code. For those not in the know: Dojo require statements essentially make requests to grab all the dojo files that they need. For a heavy duty dijit like the grid, this can add up to a lot of requests! And making these requests through the DH server was what was slowing me down.
So basically, using AOL's CDN to host all the Dojo includes make things insanely faster (load times below!). I guess fast javascript isn't enough, but when dealing with massive JS requests and includes, having a fast host is just as important. Lesson Learned!
DreamHost Hosted Example - Load Time: 27.86s
AOL CDN Hosted Example - Load Time: 2.96s
Wow.


May 5th, 2008 at 4:51 pm
You would probably also get better performance with a build. The Grid specifically includes lots of different JS files and with a build it would only download 2 files (dojo.js and YourBuild.js).
May 5th, 2008 at 5:55 pm
Nice find!
So basically dojo rents out the AOL CDN for all of its users to access the library files?
Did you find any other lists of things people put on CDNs for others to take advantage of?
May 6th, 2008 at 9:23 am
@David: I would be somewhat interested in how to make my own build. I know you’ve done it before, but this may be something I’ll have to try. Any links/tutorials you could point me to? Otherwise there’s always google I suppose.
@Jason: I may be wrong, but I’m under the impression that AOL merely hosts the files on their CDN just because they support dojo and use it for some of their apps. Not sure if you actually meant that Dojo pays AOL to keep their files on there, but AOL is supposedly pretty into Dojo as well.
April 12th, 2010 at 9:39 am
Thanks a ton! That was really informative, I just Dugg your website.