with respect to CDN This word, I think we have heard and have a half-understanding of it, for its understanding is likely to have a “sense of familiarity and unfamiliar” feeling. Recently, I have studied cdn in depth, and I realized how important cdn is in the modern Internet.
In fact, to put it simply: CDNs are like warehouses set up by e-commerce companies in various cities

So let me take you on a journey today to find out what a CDN is, why you should use a CDN, and the basic workflow of a CDN.
I: The user enters the domain name of the website to be accessed in the browser; the browser will send a message to the localDNS serverRequest the resolution result of the domain name, if the local DNS server already holds the domain name resolution record, it can directly return the corresponding IP, otherwise the local DNS server will recursively query to the whole DNS system, and then return the result to the user. When the browser gets the domain name resolution result, it actually gets the IP address of the target server.
The browser initiates a request for server content from this IP; the server eventually sends the requested content back to the browser, which then renders the content into a web page, and you can see the web page content in your browser. However, it should be noted that the actual data transfer process is much more complicated than it seems. To make it easier for you to visualize it, we can simply think of the process as three nodes.
Second: server data transmission process: If there is no CDN, the transmission path of website data is usually, website server → public network outlet → long-distance backbone network → user's LAN → access network → user's LAN → user's browser, of which, long-distance backbone network transmission is the most time-consuming as well as the most costly part. The data needs to cross the server room where the server is located, the backbone network, the user's local network and other layers, the physical distance is usually very far.

Third: In this case, if: the number of users visiting is very huge, which can easily trigger network delays, slow loading pages and other problems, seriously affecting the user experience.
At the same time, each request further loads the long-haul backbone network. A typical example is the ticket rush during China's Spring Festival: during the peak of the Spring Festival, the number of users accessing the 12306 website can reach a billion.
However, a large number of images and static resources on a page are virtually identical for all users. Imagine if 100 million people requested the same image at the same time, and each request had to go back to the origin server to be re-fetched, that would mean 100 million data transfers across the network. This would be a “disaster” for the national Internet infrastructure.
But surprisingly, 12306 was not paralyzed by this. So how did it cope with such extreme traffic scenarios? The answer lies in the CDN (Content Delivery Network).
So what is a CDN?
CDN is EnglishContent Delivery NetworkThe acronym, directly translated, is Content Delivery Network, CDN is the full name of the content delivery network
In layman's terms, CDN is the core idea of a simplified form of user experience. This avoids the need for data to repeatedly traverse a remote backbone network, thus: relieving backbone network pressure, reducing latency when accessing the network, and improving access speed and overall stability. Without CDN, each request must start from the source server, go through the public network exit and long-distance backbone network to reach the user's browser. After the introduction of CDN, the access path will change.

The Role of CDN Caching Servers
When the browser requests static resources such as images, it is prioritized to the CDN cache server; if the corresponding resource exists in this node, it will be returned directly to the user; only in the case of no cache, the request will be returned to the source server via the long-distance backbone network.
Simply put, it is to put the resources of the website in advance to the CDN node closer to the user, so that the user does not have to visit across the province, or even across the region to request the source server, the natural network latency is lower, and the overall cost of the traffic will also be significantly reduced.
At first glance, a CDN may seem like an extra layer of servers between the user and the source, but it's not as simple as “one more machine”.
Because users are spread all over the country, if everyone goes to request the same central server at the same time, the network will definitely slow down and the experience will be poor.
Therefore, CDNs usually deploy a large number of cache nodes distributed in various regions, such as North China, East China, South China, Southwest China, and so on. When users visit, the system will automatically allow them to access the nearest node, thus fast and stable.
When a user initiates a request, the system automatically schedules the request to the nearest CDN node with the best network condition, avoiding the situation of “running back and forth half of China” in the whole country.
A CDN is essentially a content delivery network that consists of a large number ofcache serverNodes. Each user visit is intelligently directed to the nearest node to the user to access the content, thus ensuring a fast and stable access process.
How does a CDN work?
Having said that, I believe we are already clear about the role and value of CDN. However, in practice, the CDN is how to cooperate with the DNS mechanism to carry out scheduling in the vicinity of the internal process is in fact relatively complex. This part of the content we will continue to explain in detail later.
Like and favorite if you like, thanks for reading.

