1. What is a CDN
The full name of CDN is Content Delivery Network, that is, content distribution network. Its purpose is to add a new layer of CACHE (caching) layer to the existing Internet, and publish the content of the website to the node closest to the user‘s network “edge”, so that users can obtain the required content nearby and improve the user experience. Responsiveness of access to the website. Technically solve the reasons such as small network bandwidth, large number of user visits, uneven distribution of outlets, etc., and improve the response speed of users visiting the website.
To put it simply, the working principle of CDN is to cache the resources of your source site on CDN nodes located all over the world. When users request resources, they will return the resources cached on the nearest node, instead of requiring each user‘s request to return to your Obtaining from the source site avoids network congestion, relieves the pressure on the source site, and ensures the speed and experience of users accessing resources.
- Solving the “first mile” problem on the server side
- Mitigate or even eliminate the impact of interconnection bottlenecks between different operators
- Ease the export bandwidth pressure of the provinces
- Alleviate the pressure on the backbone network
- Optimized the distribution of hot content on the Internet
2. Working principle of CDN
- The user enters the domain name to visit, and the operating system queries LocalDns for the IP address of the domain name
- LocalDns queries ROOT DNS for the authoritative server of the domain name (this assumes that the LocalDns cache expires)
- ROOT DNS responds to the domain name authorization dns record to LocalDns
- After LocalDns obtains the authorized dns record of the domain name, it continues to query the IP address of the domain name from the authorized dns of the domain name
- After the domain name authorization dns queries the domain name record, it responds to LocalDns
- LocalDns will get the domain name ip address and respond to the client
- After the user gets the IP address of the domain name, he visits the site server
- The site server responds to the request and returns the content to the client
CDN access process
From the above figure, we can see that the access process of the website after using the CDN cache becomes:
- The user enters the domain name to visit, and the operating system queries LocalDns for the IP address of the domain name.
- LocalDns queries ROOT DNS for the authoritative server of the domain name (this assumes that the LocalDns cache expires)
- ROOT DNS responds to the domain name authorization dns record to LocalDns
- After LocalDns obtains the authorized dns record of the domain name, it continues to query the IP address of the domain name from the authorized dns of the domain name
- After the domain name authorization dns queries the domain name record (usually CNAME), it responds to LocalDns
- After LocalDns obtains the domain name record, it queries the IP address of the domain name from the intelligent scheduling DNS
- Smart Scheduling DNS Responds to LocalDns with the most suitable CDN node ip address according to certain algorithms and strategies (such as static topology, capacity, etc.)
- LocalDns will get the domain name ip address and respond to the client
- After the user obtains the IP address of the domain name, he visits the site server
- The CDN node server responds to the request and returns the content to the client. (On the one hand, the cache server saves it locally for later use, and on the other hand, returns the acquired data to the client to complete the data service process)
Through the above analysis, we can conclude that in order to achieve transparent access to ordinary users (the user client does not need to make any settings after using the cache), it is necessary to use DNS (Domain Name Resolution) to guide users to access the Cache server to achieve transparent acceleration services. Since the first step for users to visit a website is domain name resolution, it is the simplest and most effective way to guide users to visit by modifying DNS.
Components of a CDN network
- Smart Scheduling DNS is a key system in CDN service. When a user visits a website that joins CDN service, the domain name resolution request will be finally handled by “Smart Scheduling DNS”.
- Through a set of pre-defined policies, it provides the user with the node address closest to the user at that time, so that the user can get fast service.
- At the same time, it needs to maintain communication with the CDN nodes distributed in various places, track the health status, capacity and other information of each node, and ensure that the user‘s request is allocated to the nearest available node.
Cache function service
- Load balancing equipment (such as lvs, BIG/IP of F5)
- Content Cache server (such as squid)
- shared storage
3. Explanation of terms
CNAME record
CNAME domain name
DNS
DNS stands for Domain Name System, which means domain name resolution service. Its role in the Internet is to convert the domain name into an IP address that can be recognized by the network. People are used to memorizing domain names, but machines only recognize IP addresses. There is a one-to-one correspondence between domain names and IP addresses. The conversion work between them is called domain name resolution. Domain name resolution needs to be completed by a dedicated domain name resolution server. The process is automatic. For example: www.baidu.com entered when surfing the Internet will be automatically converted to 220.181.112.143.
Back to source host
Back-to-origin host: The back-to-origin host determines the specific site on the origin site that the back-to-origin request accesses.
Example 1: The source site is a domain name. The source site www.a.comis , and the back-to-source host is www.b.com. Then the actual back-to-source request is the IP resolved to `www.a.com, and the site www.b.com on the corresponding host
Example 2: The source site is the IP source site is 1.1.1.1, and the back-to-source host is www.b.com, then the actual back-to-source is the site www.b.com on the host corresponding to 1.1.1.1
Protocol back to source
DWDM OTN platform, HT6000 and HT6800.