1. The user enters www.web.com this domain name to the browser, the browser discovers the local no DNS cache for the first time, requests to the website DNS server;
2. The DNS domain name resolver of the website has set up the CNAME, pointing to the www.web.51cdn.com, the request points to the intelligent DNS load balancing system in the CDN network;
3. The intelligent DNS load Balancing system resolves the domain name and returns the IP node with the fastest response to the user.
4. The user makes a request to the IP node (CDN server);
5. As the first visit, the CDN server requests the original web site and caches the content;
6. The request results are sent to the user.
CDN Network is between the user and the server to increase the cache layer, how to direct the user's request to the cache to get the data from the source server, mainly by taking over the DNS implementation, this is the most basic principle of CDN, of course, many details are not involved, such as the 1th step, first to the local DNS server request. 5th step, Content elimination mechanism (based on TTL) and so on. But the principle is roughly the same.
When a user accesses a website that joins a CDN service, the domain name resolution request is eventually handed over to the global load Balancer DNS for processing. Global load Balancing DNS uses a predefined set of policies to provide the user with a node address that is closest to the user, enabling users to get a quick service. At the same time, it maintains communication with all CDNC nodes distributed around the world, collects the communication state of each node, ensures that the user's request is not assigned to the unavailable CDN node, and actually does global load balancing through DNS.
For ordinary Internet users, each CDN node is the equivalent of a web that is placed around it. With global load balancing DNS control, the user's request is transparently directed to the node closest to him, and the CDN server in the node responds to the user's request as if it were the site's original server. Because it is closer to the user, the response time must be faster.
Each CDN node consists of two parts: a load balancer device and a cache server
Load balancer is responsible for the load balancing of each cache in each node, which ensures the efficiency of the nodes, and the load balancing device is responsible for collecting the information of the nodes and the surrounding environment, maintaining the communication with the global load DNS, and realizing the load balance of the whole system. The management system of CDN is the guarantee that the whole system can operate normally. It can not only monitor the subsystems and equipment in real time, but also produce corresponding alarms for various faults, and can monitor the total traffic and the traffic of each node in real-time, and keep in the database of the system, so that the network manager can make further analysis conveniently. Through the perfect network management system, the user can modify the system configuration.
Theoretically, the simplest CDN network has a DNS that is responsible for global load balancing and one cache for each node to run. DNS supports resolving different IPs according to the user source IP address to achieve the nearest access. To ensure high availability, it is necessary to monitor the traffic, health status, etc. of each node. A node of a single cache bearer is not enough, only need more than one cache, more than one cache at the same time, only need a load balancer, so that the cache group work together.
A diagram of how the CDN network works