Content Delivery Network

CDN VS CACHING

Suraj Panker

--

Today is Hanuman Jayanti. I am celebrating Hanuman Jayanti with starting a new thing or new Purpose. Let’s go to understand New topic Content Delivery Network (CDN) vs Caching. This article has two parts. The first part is a Caching and the second part is CDN. Before understanding CDN I am starting from caching so let’s go.

CDNs are geographically distributed networks of proxy servers. Its main objective is to serve content to a user more quickly. If we talk about caching so caching is a process to store information for a set of periods on our computer.

So the main difference between these two is while CDNS performs caching, not Everything that performs caching is a CDN.

What is caching:- If you want to improve the web site’s speed, caching comes in mind. Caching means that the content is going to be stored somewhere so that it’s easily accessible and this reduces the time for a visitor to access data on a web site.

Site caching(page caching)

Page Caching(Site Caching): It is also known as HTTP. When we use any website then It stores data like image, webpage and other data temporarily in an unused portion of RAM and it doesn’t impact memory.

When a visitor comes again on-site, the content can be load quickly. In the same way, children can memorize multiplication tables, once it is memorized, the answer can be recalled almost instantly. Page Caching is limited in the way it performs caching. It can communicate how long to store the save data. Publishers set rule for the visitor because they see fresh content. So this way, pages that haven’t been changed will still b served from cache. if images or other types of data updated, it will be refreshed and cached for later visits.

This happens a lot with WordPress.Publisher installs one of the many caching plugins available like WO Rocket, W3 total cache, etc and they now have cached, suppose rules are not set appropriately, you may have given yourself a slower site or you have created a situation where your visitor is not able to see your most recent version of your site.

Source: Medium

Browser Caching:- It makes the experience on the web much faster for the sites We visit regularly. Instead of many times requesting and sending required data to display the webpage, it’s stored on your computer. It is also a type of Page caching.

How does caching work: This is a question in our mind. If someone has visited your website before on a browser They can be cookied. { Cookies are created when visiting a website. They are stored bits of information about your interaction with the website, which the webserver can use later when processing your session }. This rule You can set is, “ if the content hasn’t changed, show the visitor the same version os the site they saw before .”This makes the web page load instantly.

Browser caches store groups of files and content or later use. These types of files include:

  1. HTML pages
  2. CSS pages
  3. Java script
  4. Image
  5. Multimedia

Users can change or set the caching setting within their browser. All major browsers like chrome, firefox use browser caching. Websites can communicate with a user’s browser. When pages are updated, the browser knows to replace old content with new content and save it in place.

Caching rules and How to set?

Caching rules to allow the ability for a publisher to set parameters for how often elements of your site cached. If a visitor came to your home page earlier or today, it doesn’t make any sense for that request to call to the server for the same content. If the content hasn’t changed, delivering a cached version of your site allows it to load instantly. You want a good browser for your users.

Most publishers are familiar with caching rule because of recommendations in google lighthouse performance audit

Recommendations from the lighthouse to serve static assets with an efficient cache policy can help improve site speed and User experience. Some publishers accomplish this with caching plugins. Other who know HTML Can hand-code the “max-age ” directive to tell the browser how long it should cache the resource.

31557600 is one year to your browser. 60 seconds * 60 minutes * 24 hours * 365.25 days = 31557600 seconds.

Using Cache-control: No-cache code if the content changes, but you still want some of the benefits of caching , The Browser will still cache the resource that’s set to no-cache, but checks with the server first to make sure the resource is still the same version before fetching.

The next part coming soon……..

Be alert

to keep eagerness to know New things

https://www.linkedin.com/in/suraj-panker-ab0359172/

References:

  1. https://www.ezoic.com/cdn-and-caching-difference/
  2. https://www.google.com/search?q=cdn+vs+cache&tbm=isch&chips=q:cdn+cache,g_1:content+delivery+network:Sxl70SVKbi4%3D&hl=en&ved=2ahUKEwiy-8q_ytfoAhWBLbcAHQCwBlIQ4lYoBXoECAEQGw&biw=1280&bih=640#imgrc=r-kSpHFxYg6vMM
  3. https://www.makeuseof.com/tag/whats-a-cookie-and-what-does-it-have-to-do-with-my-privacy-makeuseof-explains/

--

--