views:

86

answers:

3

Hi,

I have a domain specifically for static content, so cookies don't travel along with requests to images/scripts/css. Now, I think I've read somewhere that most browsers only open one download thread for each domain/subdomain, so different static content can't be downloaded in parallel if on the same domain. Will it make difference for browsers if i place scripts in script.mycdn.com, styles in css.mycdn.com and images in images.mycdn.com? Will it allow to let browser download images at the same time as scripts and styles?

mycdn.com is of course a made up name :)

Thanks! Andrey

+2  A: 

It is my understanding that browsers will make up to two simultaneous connections per host (server). So, distributing your assets across multiple servers like this should indeed allow the browsers to download them in parallel.

GBegen
A: 

I would be very cautiously when trying that. It might be that some browsers might load it faster because of that. But on the other hand you get a whole host of problems.

Browsers might not load content from different domains at all because of cross-site-scripting or other protection mechanisms (like InPrivate filtering in IE). And of course the server has to handle more open keep-alive connections.

And of course doing that will make the loading of the site (slightly) slower for everyone who is limited by his own connection speed (Because there will be more and longer transfers).

Foxfire
Not sure I understand the problems you are describing here - a whole bunch of high load servers are using some other domain names to host static content (yahoo, facebook, etc.) and I haven't seen any problems with that so far. Now, we are going to host static content at a CDN like Akamai, so I don't care about server's open connections - I'm sure they can handle that :)
Andrey
A: 

Most browsers make simultaneous requests per domain for static assets. Older browsers like IE6-7 and Firefox 2 make 2 simultaneous requests per domain while newer browsers like Firefox 3 download 4-6 assets in parallel. By disabling cookies on your asset host you will also be decreasing the amount of data being sent to clients.

In terms of the number of asset hosts, you don't want too many since each one requires an additional DNS lookup. This yahoo research article recommends using at least two and no more than four different asset hosts.

Keep in mind that downloading scripts are blocking operations (i.e. they prevent other assets from being downloaded in parallel) so you will want to do your best to minimize the amount of javascript being downloaded and potentially move it to the bottom of page if possible.

jkupferman