What Is CDN?

How does CDN work?

When a user tries to access the webserver data(website) from a particular location, if the CDN settings are configured for the website, then the request first goes to nearby optimal CDN node. Now, if the CDN already has the requested data cached on that node, then it is served to the user from that node without the need to go back to the origin server. However, if the data is not cached on to the CDN node serving that user, then request first goes to CDN node, then from there it goes to the origin server. CDN node then fetches the data from the origin server and serves the user’s request. Moreover, CDN node caches this data to serve any future requests from this user or any other user requesting that data from this node. So, in principle, using CDN on a website, only the first user requesting specific content suffers an extra latency and all the user requesting this content in the future would have faster access to this specific content because it would be served from the CDN node. Of course, this depends on the content cache setting of the content (e.g. website cache settings) as these settings may require CDN node to fetch the content again based on the content expiration time. This is explained a bit more at the bottom of this page.

What does it mean in a real-world situation and why do you need it?

Let’s assume you own a website which is hosted on a web server (origin of the content) and serves images of inspirations quotes to the website visitors. As you started your website, you hosted it in a particular geographic location, say UK. Initially when the website started, you may see visitor from UK visiting your website to see and download content. As your website starts to get popular, more users from UK and abroad starts to access your website. This creates three challenges. First, as more users are accessing the same webserver, the load on webserver increases and it would not be able to serve all the users at the same time, in turn, causing bad user experience in accessing your website. Second, as the origin server is located in UK, users accessing it would face latency because the data is transferred over internet from a geographically distant location. Third challenge is the bandwidth cost that you need to pay to serve content from the origin server as a greater number of users require more bandwidth to serve the content.

Website Cache settings

Website cache setting can play an important role in CDN content caching. Based on the website cache settings, CDN can cache contents from a web server. There are different cache settings which can cause a CDN node to download the content every time or can request nodes to check the server if the content has expired or not. You can read about cache configuration in more details by clicking the link.

Original Source:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

4.97K Followers

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com