2 - [high concurrency - Service] - 3 CDN content distribution

1 Web front-end optimization

  1. Use Site static and dynamic separation architecture;
  2. Reduce Httptransmission requests CSS/JScombined transport, compression JS, CSStechniques;
  3. Use the browser cache static resources, reduce server stress;
  4. Use CDNcontent distribution, reduce broadband transmission, access user IPassigned to the nearest server access;
  5. Front and rear ends separation techniques.

2 combat CDNcontent distribution

2.1 DNSdomain name resolution process

DNSThat Domain Name Systemis the meaning of domain name resolution services. It is the role of the Internet: the domain name can be converted into a network to identify the IP address. People used to remember domain name, but only recognize each other between the machine IP addresses, domain names and IP addresses between one to one conversion work between them as domain name resolution, domain name resolution needs to be done by a dedicated DNS server, the entire the process is automatic.

Common DNSresolution service providers are: Ali cloud resolution, resolve million net, DNSPod, the new network parsing, Route53 (AWS), Dyn, Cloudflare and so on.

2.2 traditional way of requests for static resources

If you do not use the CDNserver, then go is HTTPrequested, in essence Request, and Response.

Traditional way architecture drawbacks:

  1. Pressure bandwidth of the transmission;
  2. Because all gathered to all users accessing a server on the same area, we can not ensure the overall system availability;
  3. Because if the client and server-side transmission distance farther, then broadband transmission is very resource intensive, resulting in poor user experience very slow response.

2.2.1 What is CDN

CDNAcceleration means that plus a caching mechanism, dynamic access between the user and our server IPaddress based on geographical location, allowing users to the nearest server access.

CDNStands Content Delivery Network, that is 内容分发网络.

CDN It is a set of geographically distributed across multiple Web servers, for more effectively publish content to the user, while optimizing performance, will be selected based on distance.

CDN The system can in real time the overall information connected to the network traffic and each node, the load conditions and the user's distance and response time of the user redirects the request from the user nearest service node, which purpose is to enable the user to the nearest access request data and solve network congestion, improve access speed, solve network bandwidth is small, user access to large, uneven distribution network causes the problem of slow access speed.

Since the CDNdeployment of the network operator's room, these carriers and a provider of end-user network, and the first hop of user requests to reach the CDNserver, when the CDNserver buffers the data requested by the user, can then be from CDNdirectly back to the browser device, it is possible to improve the access speed.

CDNThe ability to cache JavaScriptscripts, CSSstylesheets, images, icons, Flashand other static resource files (not including the html page), the frequency of these static resource access text files is very high, it will cache CDNcan greatly improve the speed of access to the site, but due to CDNthe deployment of in the network operator's room, so they are rarely used in the general website CDNacceleration.

2.2.2 CDNcontent distribution principle

  1. To provide users with access to the domain name to the browser;
  2. The browser calls the DNS database of the domain name resolution, because the CDNdomain name resolution process has been adjusted, so parsing libraries generally get is the domain name corresponding CNAMErecords, in order to get the actual IPaddress, the browser needs again to obtain the CNAMEdomain name resolved to get the actual IPaddress; in this process, using the global load balancing DNSresolved, such as geographic location information corresponding to resolve IPthe address, so that the user can access the nearest;
  3. The parsed CDNcache server IPaddress, browser actually get in the IPfuture address, issues an access request to a cache server;
  4. The browser cache server provides the domain name to be accessed by Cachean internal dedicated DNSobtained actual parsing the domain IPaddress, then the cache server of this actual IPcommit access request address;
  5. From the actual cache server IPafter the address contents have been, on the one hand be stored locally, for later use, on the other hand returns the acquired data to the client, the completion of a data service process;
  6. It is displayed after the data returned by the client to obtain the server cache the entire browser and completes the data request procedure.

2.2.3 Ali cloud environment to build combat CDNcontent distribution

Here Insert Picture Description

step:

1, create a cloud Ali CDNAddress
Here Insert Picture Description

2. Go to parse CNAME
Here Insert Picture Description

2.3 Glossary

2.3.1 CNAME 记录

CNAME I.e. aliases (Canonical Name); it can be used to resolve a domain to another domain.

When the DNS system at the time of the query name CNAME left, will shift to the right of the name CNAME further inquiries, has been traced to the last name of the PTR or A, will respond to inquiries after the success, or failure.

For example, you have a lot of information stored on a server, you use docs.example.comto access these resources, but hopes to documents.example.combe able to have access to these resources, then you can in your DNSadd a resolution service provider CNAMErecords, the documents.example.compoint docs.example.com, the article added after the CNAME record, all access documents.example.comrequests will be to docs.example.comget the same content.

2.3.2 CNAME 域名

Access CDNwhen, after Ali cloud console finished adding speed up domain, you'll get a domain name CNAME Ali cloud CDN assigned to you, (the CNAME domain name must be *.*kunlun*.com), you will need to resolve service providers add a CNAME record to your DNS, will accelerate their domain name to point to this *.*kunlun*.comthe CNAME domain name, the domain name so that all requests will Ali cloud will turn the CDN nodes to achieve accelerated results.

Published 675 original articles · won praise 214 · Views 140,000 +

Guess you like

Origin blog.csdn.net/weixin_42112635/article/details/105069315