What is a CDN? How does it work?
Sites typically have all of their servers in one place. As the user base grows, companies must deploy content on multiple geographically different servers. To reduce the time of HTTP requests, we should place a lot of static resources close to users. Content Delivery Networks (CDN) CDN is a group of Web servers distributed in different geographical locations, which are used to release Content to users more effectively. Avoid bottlenecks and links that may affect the speed and stability of data transmission on the Internet as far as possible, so that the content transmission is faster and more stable. Through the server placed throughout the network node of a layer of intelligence on the basis of the existing Internet virtual network, CDN system can in real time according to the network traffic and each node connections, load condition and the distance to the user and comprehensive information such as response time Will the user's request to guide user nearest service node. Infrastructure: The simplest CDN network consists of a DNS server and several cache servers 1. When a user clicks the content URL on the web page, the local DNS system resolves the domain name to the CDN dedicated DNS server pointed to by the CNAME. 2. The DNS server of the CDN returns the GLOBAL load balancing device IP address of the CDN to the user. 3. The user sends a URL access request to the global load balancer of the CDN. 4. The CDN global LOAD balancing device selects a regional load balancing device in the region to which the user belongs based on the USER IP address and URL of the requested content and sends the request to the device. 5. The LLB selects an appropriate cache server to provide services for users. The selection criteria are as follows: Determine which server is closest to the user based on the user'S IP address. According to the content name carried in the URL requested by the user, determine which server has the content required by the user; Query the current load of each server and determine which server has service capability. Based on the above analysis, the LAN load balancer returns the IP address of a cache server to the global load balancer. 6. The global load balancer returns the SERVER IP address to the user. 7. The user sends a request to the cache server. The cache server responds to the request and sends the required content to the user terminal. If the cache server does not have the content the user wants, and the zone balancer still allocates it to the user, the server requests the content from its upper-level cache server until the source server that traces it back to the web site pulls it locally.Copy the code