These assets on your site are amongst the first topics in need of a CDN. If your site is a tiny blog, it probably won’t matter since the cut in load time will be negligible, but, what about the big ones?
For this experiment, I will set up a CDN77.com account for my tech/video games site, it’s a very costly site “assets wise” with a size of no less than 2.4MB and more than 95 requests. In laymen terms, it’s a heavy burden for the browser and the server to load. Being a magazine with tons of news, there is no way to make this better. The server is already a high-end one and having to cut on content is definitely a no-go.
There are tons of sites like these on the internet. I keep hearing voices about how useless a CDN is for any kind of site (big or small) and I just can’t help but marvel at those kinds of comments.
In this article today, I’m going to examine why CDNs are important and matters (very much). You’ll see, with numbers and evidence, why having a CDN matters a lot, especially if you have customers far away from the place your server is located. Having to load a site with few assets is one thing, but medium to big sites will greatly benefit and I will show you why…
For the purpose of this experiment, I’m going to use Pingdom Tools. Of all the free tools you can come up with to test site’s actual speed and load time, Pingdom Tools is one of the best (and most accurate too). Pingdom measurements include waiting times for assets that may be external and most importantly asynchronous. Loading time for an end user is hence slightly shorter. First, we are going to load the website right from the server, with no CDN whatsoever. Take into consideration that the server is already fast enough, a Xeon running at 3.3Ghz on Nginx with FastCGI cache is no small feat and it should load pretty fast on its own.
In the picture you can see that the total load time is about 2.64 seconds, for this experiment I’ve used the San Jose server in California, USA, since my server is located in North Carolina, USA, the load time should be low enough. On the right screen, you can see all the resources (assets) being loaded with their actual times.
As you can see, as soon as the request comes from a far away place, things starts to go down… The website lowered it’s score to 86 and now the load time is around 5.20s, this is what happens when more than 95 requests have to travel all around the globe. Take into consideration the speed of light and all those pesky files will only increase the total load time, there is just no way around it.
Now let’s activate CDN77 so it starts to retrieve all the assets automatically and see what happens…
Now this is the first drawback of using a CDN. If interpreted improperly, it could lead to a wrong opinion that the CDN is not working. The first time the website is loaded, CDN service needs to retrieve the assets from the origin server and load them from the closest location where it was solicited. You can clearly see the load time has actually increased to 6.36s and on the right image you can see why. On the X-Cache response header is the answer. The CDN service responded with a “MISS” clearly indicating that the asset was not previously cached and needed to be loaded “on the fly”, this is what makes the CDN solution slower, but only on first load. Since the asset needs to do a roundtrip from the CDN service back to the origin server and then back to the internal network and away to the closest server in the location that was solicited. The roundtrip is not that slow after all but the X-Cache parameter will clearly help you identify when it’s being cached or not. Now, is Pingdom Tools cool or not?
Let’s see what happens on a second run…
It’s alive! Now we are talking. You can see that the load time decreased to 2.48s which is now faster than the original benchmark without CDN. Also, on the right image you can now see the “HIT” being displayed in the response header, signaling the browser that the request has been cached and it’s been provided from the closest server to that location without having to do any more roundtrips.
In the previous example, we saw that when using the site outside of the US and outside of the country where the website is located, things started to get ugly, let’s see what happens with CDN enabled.
The first load on the left, gave us a time more or less similar to the original benchmark, if not better. This is without the actual request being cached, now, on the right image you can clearly see the improvement and it’s not a small one. We now have gone from 5.20s without a CDN to a whopping 2.34s to load the entire site, this an improvement of more than 2X since now only the basic PHP files are loaded from the origin server while all the rest of the assets are loaded locally from the Stockholm server on CDN77 !
You want a proof? Sure thing. Here it is:
Now, let’s go to the extreme…
Loading the site from Australia is just so painful without a CDN and my website has now turned into the slowest of the bunch, giving a score of 77 and a C, oh well..
With CDN77 enabled, the speed increase is impressive and almost a 2X difference. The score is back to A, of course, once again proving that CDN actually works, as it should be.
Now let’s put all this into perspective, shall we?
This graph almost speaks for itself on how CDN actually improves performance related to where the site is located. If your readers/customers are accessing the site in the same country/location where your server is located, why ask for a CDN right? It won’t make things better. In the best-case scenario, it will only help your server with the resources and it will reduce the CPU time involved but it won’t improve the load time. But as soon as one of your readers is trying to access the website from outside the country where your server is, the performance improvement goes to 2X, very easily. There is no denying, you can go ahead and do all these tests yourself. CDN matters a lot if your site is read from around the world and it will also ease the bandwidth requirements on your server.
Having a CDN on your international site is a must. Be it a tech blog, a digital magazine or a product site. If you care about performance and your customers/readers are located around the world, CDN will indeed speed up your WordPress website a lot. Also, the more assets your site loads from the various locations, the bigger the improvement. Having a CDN is not a bed of roses situation though. Managing the service properly is paramount to its performance. Remember, the first request will always be slower, having the CDN cache the site properly is very important.
In the next article, we will examine on how to properly configure the CDN77 service with WordPress, how to set up its locations and take the most out of it so you can experience the same benefits as in this article. Stay tuned!
Don’t forget to check out our post on the best free CDN services out there. Some of these are 100% free up to a certain point while others are free during a trial period. While CDN77 is a good option we would like you to check out these other great services so you can choice the one that best works for you.