Home >Common Problem >what is cdn cache
cdn allows the traffic or browser that originally accessed the main server to access the cache server deployed nearby for processing. This can greatly reduce the pressure on the main server, and at the same time It can improve user access speed and reduce bandwidth pressure.
The operating environment of this tutorial: Windows 10 system, DELL G3 computer.
To put it simply, cdn allows the traffic or browser that originally accessed the main website server to access the cache server deployed nearby for processing. In this way, the main server can be greatly relieved. pressure, and at the same time can improve the user's access speed and reduce bandwidth pressure.
Generally, websites that require CDN services will choose the following organizational plan:
1. Provide additional CDN services through rented IDC;
2 ..Purchase the services of a professional CDN service provider;
3. Build your own CDN network; the cost will increase accordingly.
The purpose of Cdn design is to achieve load balancing of web content and prevent access request hotspots, delayed responses, etc. It can also be used in game architecture to improve the speed of game access to pull resources.
Features of Cdn:
1, distributed storage,
2, content distribution through intelligent dns resolution or http redirection Load balancing,
3, global load balancing management and content management,
Composition of Cdn:
The functional entities included in the cdn network include It is composed of content caching equipment, content router, CDN content management system, etc.
Content caching: It is a CDN network node, located at the user access point. It is a content providing device for end users and can cache static WEB content and streams. Media content realizes edge dissemination and storage of content so that users can access it nearby.
Content switch: Located at the centralized point of user access, it can balance the load of a single content cache device and perform load-balanced access control on the content.
The content router is responsible for transferring the user's The request is scheduled to the appropriate device, dynamically balancing the load distribution of each content cache site, selecting the best access site for the user's request, and at the same time improving the availability of the website. The content router can develop routing based on a variety of factors, including site and User proximity, content availability, network load, equipment status, etc.
Note: Load balancing is the core of the entire CDN, and the accuracy and efficiency of load balancing will directly determine the efficiency of the entire CDN.
Cdn cache: The cdn cache is a register that temporarily stores network signals. This large number of network request signals will be cached in the cdn database. Then the cdn database will allocate different network request signals based on the current status of the network server, which can make many Idle network servers can also work.
Cdn network structure:
Cdn network is generally divided into center and edge nodes. The center is responsible for global load balancing management. And content management..
Architecture diagram:
Here cdn is divided into layers: In the cdn system, cache devices responsible for providing content services to users are deployed in The entire CDN network is at the edge, so it becomes an edge node.
The central layer of CDN is responsible for global management and control, and at the same time saves the most cache. When the edge layer misses, the central layer will be requested , if the central layer does not hit, it will request data from the source station. If the source station returns it to the central layer, or the central layer itself has corresponding data and returns it to the edge layer, the edge will return it to the user and at the same time it will be local Carry out a cache.
If the system is relatively large and the edge layer requests too much content from the center, a regional node is needed to act as a proxy and be responsible for the management and control of a region.
The working principle of CDN
The CDN network adds a layer of cache between the user and the server. How to guide the user's request to the cache requires the use of dns and the analysis and adjustment of dns. A forwarding of the request.
Rough process: 1. The user requests a domain name, 2. The browser parses the domain name. The detailed dns resolution process will not be explained here. Since cnd has adjusted the domain name resolution process, the domain name obtained through the function parsing library is the domain name after the cname record corresponding to the domain name, so the browser The cname domain name will be accessed again and the IP will be requested. In this process, the global load balancing strategy is used for DNS resolution, which is resolved to the nearest location based on geographical location and other information, allowing users to access it.
3. Obtain the IP address of the cached server, and the browser initiates an access request.
4. After the cache server resolves the request through the dedicated dns inside the cache, it obtains the real IP of the domain name, and then sends the request to the real server. Send a request and request the corresponding data.
5. The origin server sends the response data. After the cache server obtains the data, it caches a copy locally for backup, and then returns a copy to the user to complete the process.
Content distribution technology:
When the origin site needs to distribute content, it can distribute the content to the CDN intermediate source, and then the CDN intermediate source forwards the content to each CDN node. If the CDN node needs to request a certain URL content request, the request will be sent to the CDN intermediate source first. Then the CDN intermediate source actively sends the request content to the origin site, and finally stores the obtained data on the intermediate source and content node, thereby achieving the effect of node acceleration.
It is mainly divided into two methods, active push : The origin server pushes the latest data to each node for updates.
Passive push: Passive access means sending a request to the mirror server when the user accesses it. If there is content on the mirror server, it will be returned directly to the user. If not, go to the server origin site to obtain it and return it to the user.
At the same time, the content on the CDN edge node is not updated in real time. The files are stored in the form of key-value pairs. The key of the key-value pair Usually it is the URL of the file. The value stores the location of the file in the server, or the binary value of the file, and also stores the http header information of the file.
The above is the detailed content of what is cdn cache. For more information, please follow other related articles on the PHP Chinese website!