tags:

views:

401

answers:

2

Hi,

I have recently started using the Rackspace Cloudfiles CDN (Limelight), about which I have some questions:

  1. I am using jQuery, jQuery UI and jQuery tools in addition to custom JS code. Also, my site is written in ASP.Net, which means there is some ASP.Net generated JS code.

Right now what I have done is that I have combined all of the js (including the jquery code), except the ASP.Net generated JS into one file. I am hosting this on the Rackspace CDN.

I am wondering if it would make more sense to just get the jQuery, jQuery UI files from the Google hosted CDN (which I suspect would work very well in serving these files, since they will be in many users' cache already)?

This would mean one extra HTTP request, so I'm not sure if it'll help.

  1. Right now I have multiple containers for my assets. For example, in Rackspace I have 3 containers: JS, CSS and Images. The URL subdomain for all 3 is different. Will that lead to a performance penalty? Should I just use one container (and thus one domain for the CDN)?

  2. Is there a way of having the MS ASP.Net generated JS loaded from MS CDN? Would this have a performance hit as per the above question?

Thanks in advance, WT

+1  A: 

The #1 way to speed up your website is to minimize HTTP requests (Best Practices from Yahoo). So if you already are serving up your combined CSS files from a CDN, you're doing it. Serving some from google and some from your CDN adds requests.

You can't combine CSS and JS into one file unfortunately, so you're going to be stuck with one request each for CSS and JS. You might want to verify that these are served up GZIPPED.

As far as your images are concerned, the best way to speed those up is to use image sprites whenever possible.

It probably does make sense to serve the files from separate domains as this increases the number of parallel downloads. (Another article from yahoo on this). If your js & css are just two files you can probably put this on one domain and your images on another.

Keltex
hmm...interesting. Your answer does make a lot of sense. I will probably confirm this with some testing.
Wild Thing
Surprisingly, the Limelight CDN doesn't GZIP these files! I haven't done so, but will be minifying the CSS, JS files.
Wild Thing
From Yahoo's best practices site:"Reducing the number of unique hostnames has the potential to reduce the amount of parallel downloading that takes place in the page. Avoiding DNS lookups cuts response times, but reducing parallel downloads may increase response times. My guideline is to split these components across at least two but no more than four hostnames. This results in a good compromise between reducing DNS lookups and allowing a high degree of parallel downloads."
Wild Thing
+1  A: 

Is is definitely better to have your assets on a different domain.

browsers load web assets one by one or sequentially from a single host. They will not start requesting and downloading the next asset until they are finished with the previous one from the same domain. Therefore, doubling the hosts or domains can accelerate the downloading speed by about 100% because browsers can simultaneously download stuff from 2 different domains.

if cookie or session is enabled on your website, the browser would send the session cookie every time it makes a request to the domain, which sort of is useless because it’s static content – the server doesn’t need the cookie at all to serve static content such as images. It’s not only a waste of bandwidth but also a waste of communication time. To avoid this, serve all static content from a domain that is not cookie enabled.

on the contrary having JS served on sites who update the maintain that JS code could become tricky as you lose the chance to first test your current JS against the new frameworks.

XGreen
Yeah, I had read that - but I'm wondering how many hosts is too many? For example, I would love to load jquery + jquery tools from Google, jquery ui from their own cdn (they provide one free), MS JS files from MS's CDN, etc. - but wouldn't that lead to a lot of HTTP requests? Yes, these would be cookieless requests, but wouldn't they add up?
Wild Thing
I don't think the main idea for this is to have less http request but to be able to have multiple at the same time to boost performance. so reduce the requests you have to target the assets themselves but not the CDS... like using all images in one image and selecting them by background position property....writing better js and trying to reduce their numbers...etc
XGreen
Aha! Found a guideline from Yahoo's best practices site: http://developer.yahoo.com/performance/rules.html"Reducing the number of unique hostnames has the potential to reduce the amount of parallel downloading that takes place in the page. Avoiding DNS lookups cuts response times, but reducing parallel downloads may increase response times. My guideline is to split these components across at least two but no more than four hostnames. This results in a good compromise between reducing DNS lookups and allowing a high degree of parallel downloads."
Wild Thing
yes that guide is pretty good and also have a go at reading the Y!Slow guidelines. they are very helpful for performance boost too."I hope Stackoverflow people change these links targets. its so annoying that its currently on _self" it should be _blank
XGreen