Maximillian Laumeister
Illustration of Miku the bird-fox shouting through a megaphone while flying in the sky

3 Reasons NOT To Use A CDN For Your Website

Using a CDN to cache your website is usually touted as a no-brainer, and for good reason - it can result in big performance improvements and reduced hosting costs. However, what most people won’t tell you is that there are some niche cases where the drawbacks of using a CDN for your website outweigh the benefits.

If your website falls into most of these categories, it may perform better without a CDN:

Your website gets very low traffic

open country road with no cars

If you are running a small website that only gets a few visitors per day, then it is very likely that a CDN could slow down your website rather than speed it up. Most CDNs including CloudFlare use a “pull” model for caching files, meaning that your files will “drop out” of the CDN’s cache after not being requested for a while. Then when the file is finally requested again, the request goes through the CDN server and back to your website’s origin server, adding an extra “hop” and increasing page load time.

If you don’t have enough visitors to keep your files “hot” at all of the CDN’s locations, then the CDN will consistently be serving your visitors cache-misses, making your site slower than not using a CDN at all.

This is one of the advantages that the less common “push” model CDNs have over “pull” CDNs such as CloudFlare. With a “push” CDN, you upload your files directly to the CDN and they never drop out of the cache, so there is no need to run an origin server and there are never any cache misses. However, a drawback of push CDNs is that you usually cannot run any server-side code, and on services that do allow it, your coding environment is very limited. Also, push CDNs tend to be more expensive than pull CDNs.

Your website’s traffic is all from one geographic location

nighttime city skyline with tall buildings

The promise of a CDN is that your files will be cached at PoPs (Points of Presence) all around the world so that they will be accessible quickly by any visitor worldwide. But if you are running a website for a local business, or hosting a portfolio for a contractor who mostly works locally, then it doesn’t matter if your website loads lightning-fast for visitors on the other side of the world. If a visitor in Japan really wants to read your website about New York City flower delivery services, they can wait the extra 2 seconds for your page to arrive through the undersea internet cables (though if you had used a CDN it could have taken longer than that anyway due to a cache miss). Meanwhile your prospective customers will have a fast experience because they are geographically close to your server.

Your website is already very fast

space shuttle launch

If your website is already very fast for your visitors, then a CDN won’t make it faster. Say that I have a website hosted in San Francisco with customers in California. The server software is running on a premium hosting provider with ample bandwidth, the back-end code is well-optimized, the server uses the latest HTTP protocol, and response times are lower than 200ms.

In this case the site’s web server can serve up files just as fast as a CDN could, or maybe even faster. With respect to geographically local visitors, the only thing that adding a CDN could do is to slow down the site with cache misses. So as long as your customers are predominantly regional it may not make sense to bother integrating a CDN.

Conclusion

Using a CDN to host your website is almost always a good idea. However, there are some niche cases where it doesn’t make as much sense. If your website falls into one or more of these categories, consider whether a CDN would actually be helpful!

More Articles Tagged #tech

Comments