I come across articles all the time about how great a CDN (Content Delivery Network) is, and how much faster web pages load. It might help slightly, but I am not sold on a substantial increase. If you happen to find a CDN service that is very reasonable in price or free, then it might be worth exploring. Otherwise, I don’t see the benefit of using one at the current time, at least for the average site.
An optimized web page should load fast enough without needing to use one already with today’s download speeds. If your web site or pages are loading slow, then I would look into reducing the number of requests per page. You might check the size of your images while your at it as well. There is no sense in loading a huge 2 MB image into a small 250 x 250 area.
How Does A CDN Help Speed Up Page Load Time
The majority of web browsers currently can download 6 items (.css, .js, images, etc.) at a time per host (website/domain). The instant it finishes downloading one item another starts until it completes all requests. Overall, the process is fairly fast in most situations.
Basically you would store some of the above mention files in a CDN. Since that would be another host (website/domain) a web browser would then download 6 itmes from your website, and 6 from the CDN at the same time, or twice as many.
The only way that this would really help though is if you had a good balance of files per page stored in each location. If you only had a couple of files per page stored in a CDN, then it’s not going to speed things up that much.
Let’s assume that we have a web page that includes 120 requests, and that each one takes exactly 0.25 (1/4) second to download and complete.
If our web browser can make 6 simultaneous download requests that would be 5 seconds. (120 x 0.25 = 30 / 6 = 5)
Now if you put 6 of those images or files in a CDN you would have 114 request to your website, and 6 to the CDN. Assuming everything is running equally well on both servers that would only gain you 0.25 second (1/4 second or 250 milliseconds).
To me that’s just not worth paying for.
Of course there are all kinds of other variables that come into play like size of files, how optimal the servers are running, what internet speed the end user has, etc.
If you could manage to move half of the 120 request into the CDN, then yes it would be more apparent. The problem is it’s usually not possible, or not easy to accomplish this without manually changing various lines of code.
I am not complaining or against these things, but the majority of people I see using them only have a couple of files per page located on a CDN. To me that’s just a waste of time and money if they are paying for it to do very little if anything at all.
How Else Can It Speed Things Up
Some providers will sync your files out to multiple datacenters. What is supposed to happen is that when a visitor makes a request to your web site from Europe for example they would be sent to a datacenter closest to them to retrieve your CDN files, and the rest they would get from your server.
That’s a nice concept that makes sense. However, I have seen routing where a visitor from Europe will be sent all the way to the U.S., then back over to a European datacenter near their location. Not always, but it happens, which would defeat the purpose entirely.
Since a sub-domain is technically another host/hostname you could create a sub-domain such as cdn.yoursite.com, content.yoursite.com, or similar. Then, store as many static files (.css, .js, images, etc.) as possible per page over there, and simply link to them within your post, theme/template, etc.
That way a visitor would be able to download and make 6 requests at a time to yoursite.com, and 6 to your sub-domain (cdn.yoursite.com), which could also potentially speed up page load time.
Like I mentioned earlier none of these things are going to help that much if you only add a few static files, images, or what have you. That’s sort of a waste of time. It might be more work than what it’s worth just to shave off a few milliseconds of page load time, but that’s up to you to decide.
It might be worth it if there was an easy way to split your files evenly between your website and a CDN (or other host/hostname), but unfortunately I don’t see that happening in most cases.