CDNs and caching are important to understand for publishers because it can determine how fast your site loads. CDNs and caching are related to one another but are not interchangeable terms.
In basic terms, CDNs (Content Delivery Network) is a network of proxy servers around the world that will serve content more quickly, and caching is the process of storing information for a set period of time on a computer. The main difference between the two is that CDNs perform caching, but not everything that performs caching is a CDN.
We will break it down further.
Caching is extremely important to site speed; it allows your content to be stored somewhere so that it loads more quickly and doesn’t have to call all the back to the origin server. There are plenty of caching plugins, but these plugins can often have negative effects on your site, as plugins naturally slow down websites because of the extra content that has to load with them.
There are two main types of caching: page (site) caching and browser caching. Page caching, also known as HTTP caching, is for storing things like images, web pages, and other content when it loads for the first time. This is then stored in unused RAM (Random Access Memory) but doesn’t really effect memory. This makes it so when a user visits the page again, the content can load quickly.
There are limitations to page caching, however. It only communicates how long to store the saved data and allows publishers to set caching rules to ensure visitors see new content. This way, pages without any updates will load really fast while pages with updates will be refreshed and then saved on RAM.
Browser caching makes sites users visit regularly much faster. Instead of sending a request and subsequently the required data needed to display the webpage, its stored on your computer. Browser caching is a type of page caching. This allows visitors that have used a site before to be cookied.
Caching rules provide publishers with the ability to set parameters for how often elements of the site are cached. Elements of a website that never change, or static assets, can be loaded instantly with an efficient cache policy, while any items that have changed will load as the request is received and fulfilled.
How long you set your cache for all depends on your content. If you run something like a forum, you would want the cache refreshed often. An example of something you would want a longer cache time on is HTML/CSS, as this often doesn’t change (unless you redesign your website).
So now that we understand caching, what is a CDN?
A CDN is a network of proxy servers in multiple locations that cache website content. CDNs basically act as a means of storing your website’s information in different places around the world so that when a user requests your website, the information can be pulled from the nearest server and the request doesn’t have to travel all the way back to the origin server. There are multiple CDNs, the most popular being Cloudflare.
Basically, the difference between caching and a CDN is that caching occurs when you use a CDN service. CDN services are more effective than just using a caching plugin because the CDN sits like a layer between the user and the origin server.