Some of you are probably wonder, what does CDN stand for?
It stands for ‘content delivery network’.

 

The trick I will be describing here is how to simulate a CDN.

What we want to accomplish is having a free performance  increase and not spend any money on hardware.

For the real and complete definition of a ‘Content Delivery Network’ I’ll point you to Wikipedia.

 

What can be done to increase performance without spending any money on an expensive CDN network, is spread our content over multiple (sub)domain names and even servers if possible.

 

Due to the nature of browsers, they create between 2 and  6 simultaneous connections per host name or proxy. This was specified in this RFC.  But between 1999 and 2011 the Internet has changed allot.

Almost everyone has broadband with speeds ALLOT higher compared to all those years ago, so the Internet connections this day in age can handle more connections at the same time.

Here’s an overview for the most popular browsers with the maximum connection count

Browser # concurrent connections
IE7 and lower 2
IE8+ 6
Firefox 2 and lower 2
Firefox 3+ 6
Opera 10 and lower 4
Opera 11+ 6
Chrome 6
Safari 3 and lower 4
Safari 4+ 6

 

As you can see in the table above, only old browsers create 2 connections. Now a days, IE8 +and FF3+ create 6, much better for our broadband connections.

Reason for this is because we can start downloading images, css, js,… files much faster.
By putting images under different (sub)domain names we can accomplish this speedup.

 

An example:

Main domain crazytje.be
Images img.crazytje.be
css and javascript files file.crazytje.be
downloads download.crazytje.be

 

Browsers mostly make between 30 and 35 connections in total.

This would make it theoretical possible for the browser to make 4 times its connection limit per host name, speeding up the sites loading time.

As I mentioned in the beginning putting the files on multiple servers would help even more.

That way we don’t put load on 1 server.
By spreading the content over several domain names users pound the same web server allot more. Having several servers  solves that issue.

 

An additional tip I can give is to put static files on a lighttpd web server that doesn’t run any server side code(php, asp, …).
That way you also save the time, memory and cpu it takes to load and run these extensions.

But that’s for another time

 

Optimizing your web server: Part 1 – Gzip
Optimizing your web server: Part 2 – Keep Alives
Optimizing your web server: Part 3 – Opcode Caching
Optimizing your web server: Part 4a – PHP
Optimizing your web server: Part 4b – XDebug Profiler
Optimizing your web server: Part 5 – CDN

© 2011 Crazy's Blog Suffusion theme by Sayontan Sinha