What are static resources
Static resource
A static resource is a static file that has the same data accessed in different requests. For example, images, videos, website files (HTML, CSS, and JS), software installation packages, APK files, and compressed files.
Dynamic resource
Dynamic resources are dynamic content that has different data accessed in different requests. For example: files in the website (ASP, JSP, PHP, Perl, CGI), API interface, database interaction request and so on.
What is the CDN
Content Delivery Network or Content Ddistribute Network (CDN for short) is a distributed Network established and covered on the bearer Network and composed of edge node server clusters distributed in different regions.
The essence of CDN acceleration is cache acceleration. The static content stored on the server is cached on the CDN node. When accessing these static content, the same content can be obtained by accessing the CDN node nearby without visiting the source site of the server, so as to achieve the effect of acceleration and reduce the pressure of the source site of the server.
CDN is widely used to solve the problem of access delay caused by distribution, bandwidth and server performance. It is suitable for site acceleration, on-demand, live broadcast and other scenarios. Users can get the content nearby, solve the Internet network congestion, improve the response speed and success rate of users to visit the website.
Since access to dynamic content requires access to the server each time, the server dynamically generates real-time data and returns it. Therefore, CDN cache acceleration is not suitable for accelerating dynamic content, and CDN cannot cache dynamic content that changes in real time. For dynamic content request, CDN node can only forward back to the server source station, no acceleration effect.
The role of CDN
1. Speed up your website
2. In order to achieve cross-carrier and cross-regional coverage of the entire network
The lack of connectivity, regional ISP geographical limitations, limited egress bandwidth and other factors all cause regional websites to be inaccessible. CDN acceleration can cover global lines. Through cooperation with operators, IDC resources can be deployed, and CDN edge distribution storage nodes can be rationally deployed in backbone node vendors across the country, so as to make full use of bandwidth resources and balance source traffic.
3. In order to ensure the security of your website, CDN load balancing and distributed storage technology can strengthen the reliability of the website, quite virtually add a protective umbrella to your website, to deal with the vast majority of Internet attacks. Anti-attack systems can also prevent malicious attacks on websites.
4. For remote backup When a server fails unexpectedly, the system will call other nearby healthy server nodes for service, providing close to 100% reliability, which allows your site to never go down.
5. In order to save costs, the use of CDN acceleration can realize the national laying of the website. According to you, you do not need to consider the purchase of the server and the subsequent hosting operation and maintenance, the mirror synchronization between the servers, and do not need to manage and maintain technical personnel, saving manpower, energy and financial resources.
6. In order to let you focus more on the business itself, CDN acceleration manufacturers will generally provide one-stop service. Business is not limited to CDN, but also supporting cloud storage, big data services, video cloud services, etc., and generally provide 7×24 operation and maintenance monitoring support to ensure that the network is unblocked at any time. And put more energy into developing its core business.
How CDN works
(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.
② The DNS server of the CDN returns the GLOBAL load balancing device IP address of the CDN to the user.
③ The user sends a URL access request to the global load balancing device of the CDN.
(4) The CDN global LOAD balancing device selects a LLB device in the area to which the user belongs based on the USER IP address and URL of the requested content, and sends requests to the device.
(5) The LLB selects an appropriate cache server to provide services for users. The selection is based on the following criteria: Determine which server is closest to the user based on the user 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.
⑥ The global load balancer returns the IP address of the server to the user.
⑦ The user initiates a request to the cache server, and the cache server responds to the user request and transmits the content required by the user 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.
The DNS server resolves the domain name to the CACHE server IP address of the corresponding node based on the user IP address, enabling the nearest access. Web sites using CDN services can achieve content acceleration only by giving their domain name resolution rights to THE GSLB equipment of CDN and injecting the content to be distributed into CDN.
When there is no CDN
The web systems we see today are basically based on B/S architecture. B/S architecture, namely browser-Server architecture.
The process by which a user accesses a website through a browser or other means:
① The user enters the domain name of the website to be accessed in the browser.
② The browser requests the local DNS server to resolve the domain name.
③ If the resolution result of the domain name is cached on the local DNS server, the local DNS server responds to the resolution request directly.
④ If the local DNS server does not cache the resolution result of the domain name, it sends a recursive request for resolution to the entire DNS system and sends the result to the browser.
⑤ The browser obtains the domain name resolution result, which is the IP address of the service device corresponding to the domain name.
⑥ The browser requests content from the server.
⑦ The server sends the user’s request to the browser.
Related articles
The basic working process of CDN
Probably the most comprehensive CDN overview ever