What to do when a cdn slows down your site. FAQs and Fixes.

Disclosure: This post contains affiliate links. I may receive compensation when you click on links to products in this post. For an explanation of my Advertising Policy, visit this page. Thanks for reading!

Finding your CDN slows down your site? First, understand the problem.

A CDN is used for faster performance at site speed. Many users use CDNs however this isn’t always the best option. A CDN can actually be slower than hosting them yourself, so what can you do to fix this fubar?

The speed at which data may be sent is limited by a variety of factors, including the capacity of your network resources and when a CDN server retrieves data from your origin server.

This information may take a long time to travel if you don’t have enough bandwidth on a shared hosting account or don’t have the network capacity to keep up with demand.

It’s simple really if your CDN is slowing down your site it’s simply because of bad CDNs used.

CDNs are meant to make site speed faster, but it slows down your site if the CDN doesn’t contribute anything.

A CDN can be 30% slower or 300% slower than hosting them yourself.

You need to make sure you get a CDN that isn’t slow itself. Some CDNs use weak servers, which are still fast but don’t make CDN speed any faster.

Other CDNs use lots of popular files for downloads and other useless content which slows down the site and CDN.

It’s important to get a CDN that offers everything you need, good servers, no traffic limits and the content it promises to offer. This way you can enjoy fast CDN speeds.

It’s not just CDNs that are slow, sometimes hosting can be slow too so you need to compare CDN speed with host CDN speed to see which one is faster.

You can easily forget about your CDN or hosting being slow so it’s important to check this regularly.

There are tools out there that allow you to test CDN speed so it’s easy to see CDN speed.

Another big problem is CDNs that don’t work, this isn’t a CDN fault though as CDNs simply point out to your server CDN location but if the CDN can’t find it then there is nothing CDNs can do about that.

To fix this error it’s simply a matter of checking the CDN with a CDN checker, if CDNs can’t find your location properly then there is no CDN speed to be fast.

What factors contribute to this CDN delay?

A CDN will take up more resources than just hosting the files yourself. This problem would occur especially on shared hosting as CDNs are usually not allowed on shared hosting.

1.) Server Location: Some CDNs will be closer to some users than if you hosted it yourself which speeds up download time for those users.

2.) Routing Delays: The data will have to go through many routing servers to get to its final destination, this causes delays in download times.

3.) Download Size: A CDN may have a larger file size than the actual version because it is optimized for mobile and touch devices.

You can host a local version, but that takes up more resources on your hosting account.

4.) HTTP Headers: CDNs add their own CDN headers and this slows down site speed because it has to make a request for a CDN header.

5.) Origin Server: Your CDN or CDNs may not be as optimized or configured to handle high traffic speeds if they weren’t built specifically for that purpose.

How can I fix CDN delays?

Here are some CDN optimization techniques you can use to improve CDN performance:

1.) Host your files on a server closest to your visitors if possible.

2.) Use CDNs that don’t require CDN headers, most CDNs can do this with just javascript or rewrite rules.

3.) Test CDNs on your site if possible before making them CDN enabled.

Will CDN actually speed up my website?

Using a CDN will definitely speed up your website and the way Google ranks you. For example:

1.) If your site is hosted on a shared hosting account it’ll be crawling at the same speeds as other sites on that shared hosting account.

A CDN can boost your crawling speeds tremendously because you are no longer sharing resources with other sites.

2.) If you are hosted on a dedicated server it will also speed up crawling times if your resources are being used 100% of the time.

3.) CDNs are great because they offload your traffic from your origin servers which frees up resources to be used elsewhere resulting in better site performance.

4.) Using a CDN can help you avoid cached content as someone has to download the file from your server first before delivering it to the user so there’s no cached content, CDNs usually have a very fast global serving network.

5.) CDNs can also speed up load times because most caching mechanisms happen on the CDN end instead of on your desktop or mobile device.

6.) You can then set a long expiry on those static files which will further speed up load times as browsers don’t have to make a second request for a file that’s been cached before.

7.) CDNs also offer origin protection, this means if an attacker gets access to your website or server they can’t download directly from your server because the CDN is in between it.

8.) You can also use a CDN to speed up image load times as most images are usually large file sizes which take longer to download, using a CDN allows you to point out where those files are hosted so browsers don’t have to make requests everytime they need an image.

9.) You can host security files like scan or report files on CDNs that are configured to be only accessed by your subdomain, which will not expose any sensitive information, if it ever gets hacked like your main website would.

10.) Hosting cached content on CDNs is good for SEO as well, the more crawled pages the better and in this case it would be the content cached on the CDN.

Why is Cloudflare slowing down my site?

Cloudflare has a setting called Rocket Loader, this setting is turned on by default and can slow your site down if you have it enabled.

The solution to the problem would be to turn off Rocket Loader as it may cause a flash of unstyled content (FOUC) which results in slower load times.

To turn off Rocket Loader, you can go to Cloudflare > Settings and click on the Speed tab. Scroll down until you see Rocket Loader and uncheck it.

Not all CDNs are built equally, there are some that won’t add their CDN headers while others will.

This means if your site is already taking a long time to get through the CDN because of how it’s set up, then adding a CDN header will take even longer to load for your user.

Is Cloudflare really faster?

With more than 4 million customers Cloudflare is one of the biggest and most popular services when it comes to DDoS protection, website acceleration and security. On their website they state:

“Cloudflare runs on over 150 data centers around the world. When you sign up for Cloudflare we select a location closest to you to host your website.

Websites on Cloudflare serve content from a data center located within 200-250ms of 95% of end users around the world (measured by RIPE Atlas).

How does this help you?

Well, it means that if the speed of light was 200 miles per hour it would take at least 250 milliseconds to travel through a fiber from NY to SF.

Speed of light is fast, but it’s also the same speed for everyone no matter where you are.

This means that when a web visitor accesses your website from Brazil, China or Australia they will most likely connect to a server which is close to them, not necessarily close to you.

These users might run into the same problem that you run into when accessing their website from Europe or North America.

But, Cloudflare isn’t perfect . Like every other service it does have some caveats.  This one is particularly important because lots of “IoT” (Internet-of-Things) devices are on Cloudflare, like your smart TV or your router.

And, because of the nature of DNS, these kinds of things are often particularly difficult to patch.

So if any IoT device you own has a remotely exploitable bug in them… your router, printer, TV… anyone could be using it as an attack vector to attack other devices on Cloudflare.

And given how important DNS is and the kind of devices that are on Cloudflare, this could be a lot of devices.

This isn’t a new bug either. This has been around for quite some time, and we even discussed it back in the DDOS days of 2014.

However, now that more and more devices are on Cloudflare, like smart TVs and mobile phones, the severity of this issue is becoming more apparent as people (and researchers) investigate the larger scope of the issue.

Since Cloudflare owns such a large portion of DNS traffic, you can think about this like if Google owned your router, and that they had a bug in their router that let anyone make HTTP requests to it… not good.

In addition, since many people put very little protection on their routers or even don’t have a password on it, this may be one huge attack vector.

Personally, I wouldn’t be surprised if attackers are already aware of this and have been quietly attacking people for quite some time now.

I know what you’re thinking, “Why is this any different than all the other IoT attacks that get reported?” “What’s special about Cloudflare?”

For most IoT devices, it’s hard to patch them.

Manufacturers don’t always release new firmware and even if they do, many people aren’t willing or able to upgrade their devices, like your old TV that you leave plugged in at the back of your garage.

For these kinds of devices, we’re stuck with this for a long time.

However, for devices that have a web interface, like your router or TV. This is much easier to fix. In fact, the researchers who found it even wrote a script to automatically detect if your device is vulnerable :

If you find that you are affected by this bug and have no other option than to keep your old, unpatched device, like your router, smart TV, etc., then you can fix it by turning off Cloudflare’s proxying on that domain.

For most devices, this is as simple as changing the DNS settings to remove Cloudflare’s nameservers.

For example, for my TP-Link router I’d change my DNS settings to 8.8.8.8 and 8.8.4.4. I could go into more, but that’s beyond the scope of this post.

I just wanted to let you know that even a CDN as large and as reputable as Cloudflare has its vulnerabilities.

What to do when a CDN slows down your site, conclusions.

The way you use a CDN will determine how fast your website is, if you use it wrong with bad caching rules for instance then you’re just going to add more load time and increase resource usage.

You can find out what is causing performance issues by using Google developer tools and looking at the network tab.

The purpose of a CDN is to speed up your website for both users and Google, but you can’t expect it to make your site blazing fast unless you plan on using it correctly and configure your content to take advantage of its features.

The faster your web hosting account (server) is the faster CDNs will make your site, the longer it takes to load something from a CDN the slower it will be.

Web hosting in Iceland - OrangeWebsite.com