Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Am building a site that makes a lot of requests for javascript and css files, and I've being reading about CDNs. I have a spare domain name and hosting space which I would like to use host these static files. My main domain is hosted on shared linux box with control panel. How do I go about setting the CDN

share|improve this question
    
Do you really mean a CDN? As in a global network of servers connected to key internet points? Or do you just want a cookieless domain? –  sam Nov 30 '11 at 11:52
    
@sam yes a cookieless domain –  MrFoh Nov 30 '11 at 16:04

1 Answer 1

You don't, unless your site scales beyond a point where you start to experience performance issues because it is overloaded.

The reason for this is simple: Having resources on a CDN requires the client's browser to start an additional session, complete with DNS lookup and everything, to download them. This usually costs performance.

Beyond that, a content delivery network basically is just a fancy name for a second (third, fourth...) server: Load your main site from http://example.com and reference the static content from http://cdn-example.com. On a large scale, there is obviously more to it, but that's the fundamental.

Something else: Having to load a lot of resource files is usually a sign of weak site design: Try to combine your resources into as few files as possible. It should usually be possible to condense all your JS and CSS in only a few files.

share|improve this answer
2  
Browsers only open a certain number of connections per host. By having files spread (e.g. some on a CDN) will open more connections, thus loading the page faste. The DNS lookup is a small price worth paying. –  Frands Hansen Nov 30 '11 at 11:51
    
And often-used resources (like jQuery) get cached a single time when many sites use the same CDN, this is another advantage –  MichelZ May 22 '12 at 14:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.