当前位置:网站首页>CDN principle
CDN principle
2022-06-24 22:33:00 【Zhuge iron and steel cloud】
cdn brief introduction
There is a performance bottleneck when users access the origin service , adopt cdn Technology caches the contents of the origin to multiple nodes . When the user sends a request to the origin domain name , The request will be dispatched to the service node closest to the user , The service node responds directly and quickly , Effectively reduce user access delay , Improve usability .
understand cdn You need to know some knowledge first :
- dns Principle of analysis
- CNAME effect
dns Analytical process
No matter how much you say, it is not as good as practical application , Let's learn from the example dns Analytical process
$ nslookup www.moehot.com
Server: 10.0.0.1
Address: 10.0.0.1#53
Non-authoritative answer:
Name: www.moehot.com
Address: 139.196.3.197
nslookup yes dns The command to parse ,server 10.0.0.1 It's internal dns Server's ip. 139.196.3.197 Is the domain name requested ip.
The detailed process uses dig Command view
$ dig +trace www.moehot.com
; <<>> DiG 9.9.4-RedHat-9.9.4-72.el7 <<>> +trace www.moehot.com
;; global options: +cmd
. 518382 IN NS a.root-servers.net.
. 518382 IN NS b.root-servers.net.
. 518382 IN NS c.root-servers.net.
. 518382 IN NS d.root-servers.net.
. 518382 IN NS e.root-servers.net.
. 518382 IN NS g.root-servers.net.
. 518382 IN NS h.root-servers.net.
. 518382 IN NS i.root-servers.net.
. 518382 IN NS j.root-servers.net.
. 518382 IN NS k.root-servers.net.
. 518382 IN NS l.root-servers.net.
. 518382 IN NS m.root-servers.net.
. 518382 IN NS root1.sc163.net.
. 518382 IN NS root2.sc163.net.
. 518382 IN NS b.root-servers.net.
. 518382 IN NS c.root-servers.net.
. 518382 IN NS d.root-servers.net.
. 518382 IN NS e.root-servers.net.
. 518382 IN NS g.root-servers.net.
. 518382 IN NS h.root-servers.net.
. 518382 IN NS i.root-servers.net.
. 518382 IN NS j.root-servers.net.
. 518382 IN NS k.root-servers.net.
. 518382 IN NS l.root-servers.net.
. 518382 IN NS m.root-servers.net.
. 518382 IN NS root1.sc163.net.
. 518382 IN NS root2.sc163.net.
. 518382 IN NS a.root-servers.net.
;; Received 631 bytes from 10.0.0.1#53(10.0.0.1) in 54 ms
com. 172800 IN NS i.gtld-servers.net.
com. 172800 IN NS a.gtld-servers.net.
com. 172800 IN NS e.gtld-servers.net.
com. 172800 IN NS k.gtld-servers.net.
com. 172800 IN NS l.gtld-servers.net.
com. 172800 IN NS g.gtld-servers.net.
com. 172800 IN NS h.gtld-servers.net.
com. 172800 IN NS d.gtld-servers.net.
com. 172800 IN NS j.gtld-servers.net.
com. 172800 IN NS f.gtld-servers.net.
com. 172800 IN NS c.gtld-servers.net.
com. 172800 IN NS m.gtld-servers.net.
com. 172800 IN NS b.gtld-servers.net.
com. 86400 IN DS 30909 8 2 E2D3C916F6DEEAC73294E8268FB5885044A833FC5459588F4A9184CF C41A5766
com. 86400 IN RRSIG DS 8 1 86400 20190224210000 20190211200000 16749 . owDDrAEA9JJUhzbHNnVNjPpqTqeJrWMScHU4Wskrp9gnkBKI8+1PeBfP 6uIUeVT+0w/Vcfh03p7mw0w5DS0ub8wQUfBTfY37s1MhE45fWueTyUGt l9aMEsma0UHZV1TL2njmDhgr7koN935hhjiSv26wymuBx5CpOvF2y7ql ih4JGsWPnHLrsfnqjq9njmP/3RQnpXrJDP/+reb5DTpdqLEf9TM/OHbt 1UpkG6rMUx4Jz53pIksji/CUfbYPiuH8FrUnVJ5thn0o+o2ZPpQqSisA 9C9dYDl1o75CDC3FShp56EjfeGmm6ncY8Kz5Irer1HUjOjiudN4cCjWU NnljsQ==
;; Received 1174 bytes from 202.12.27.33#53(m.root-servers.net) in 4386 ms
moehot.com. 172800 IN NS dns9.hichina.com.
moehot.com. 172800 IN NS dns10.hichina.com.
CK0POJMG874LJREF7EFN8430QVIT8BSM.com. 86400 IN NSEC3 1 1 0 - CK0Q1GIN43N1ARRC9OSM6QPQR81H5M9A NS SOA RRSIG DNSKEY NSEC3PARAM
CK0POJMG874LJREF7EFN8430QVIT8BSM.com. 86400 IN RRSIG NSEC3 8 2 86400 20190216054237 20190209043237 16883 com. ZpsxE9/jbJ0Ues0CJFIz9X5DvvsTgUlhLjpRIrQcXbo9z+avYuhL5O7J MxzY0KbxK2hGWK2q5zesaB+9ye1v7LuEVn8OzHtyjxGxjr7sXqWiU+0W 3lFK8q2EdNOulZJrmJ/nSZGNZ3aXRpeFWLD2LYs1Eipw5D6KmBAWAy/w xvE=
HMIQOH986C2QQFJRPQJH18GTCL9922SH.com. 86400 IN NSEC3 1 1 0 - HMISVQBER3LFS6UELQ3DN9VT6QI4LL28 NS DS RRSIG
HMIQOH986C2QQFJRPQJH18GTCL9922SH.com. 86400 IN RRSIG NSEC3 8 2 86400 20190218055540 20190211044540 16883 com. R3GJVt5SSPC7MQUJTs6h0OC9qQnj2WZU2Y/ec+xbj39/Wuo/TwunvKYz NIr20VkkhMOeX/s8cfA3XheNMBdwufxLZNYTt3ptBySZdmiRKYFi/9HG jUfEcBF2tVVE/ae5qzftgIm7O+AUYxkwWMKBL4+XC3A3sV8I0Fv2fd+Y iDk=
;; Received 887 bytes from 192.42.93.30#53(g.gtld-servers.net) in 152 ms
www.moehot.com. 600 IN A 139.196.3.197
;; Received 59 bytes from 140.205.41.26#53(dns10.hichina.com) in 36 ms
Let's analyze the parsing process step by step :
- First, check whether the local cache query has the corresponding domain name resolution ip
- Without it , To the configured dns Server initiates request (10.0.0.1 Within the company dns The server ip)
- Received 631 bytes from 10.0.0.1#53(10.0.0.1) in 54 ms -- 10.0.0.1 The address of the root domain name server will be returned ( There are multiple root domain servers , So many domain names are returned )
- Received 1174 bytes from 202.12.27.33#53(m.root-servers.net) -- The local machine sends a resolution request to the root domain name , The root domain server returns .com Top level domain name server address
- Received 887 bytes from 192.42.93.30#53(g.gtld-servers.net) -- This machine to com. Domain name server initiates request , return moehot.com. Domain name server address
- Finally to moehot.com. The domain name sends a request to get www.moehot.com. Of ip Address
CNAME effect
CNAME namely : Alias record . This record allows you to map multiple names to another domain name . Usually used to provide at the same time WWW and MAIL Computer serving . for example , There is a computer called “host.mydomain.com”(A Record ). It also provides WWW and MAIL service , In order to facilitate user access to services . You can set up two aliases for this computer (CNAME):WWW and MAIL. The full names of these two aliases are Web Hosting, Domain Name Registration - MyDomain.com and “mail.mydomain.com”. In fact, they all point to “host.mydomain.com”.
stay cdn The implementation principle in is : Add... To the origin domain name CNMAE, The alias is the domain name of the acceleration node . When the user makes a request to the origin station ,dns When the server resolves the domain name of the origin site, it will find that CNMAE Record , At this time dns The server will send to CNAME Domain name request , The request will be dispatched to the domain name of the acceleration node .
Tencent cloud cdn example
Suppose your domain name is www.test.com , When the domain name is accessed CDN After you start using the accelerator , you
User initiated HTTP request , The actual processing flow is shown in the figure :

image.png
- The user to www.test.com A picture resource under , Such as 1.jpg Initiate request , First, to Local DNS Hair
Domain name resolution request ; - When Local DNS analysis www.test.com when , You will find that it has been configured CNAME
www.test.com.cdn.dnsv1.com, The parsing request is sent to Tencent DNS(GSLB),GSLB Wei Teng
Dispatch system independently developed by xunyun , The best node is assigned to the request IP; - Local DNS obtain Tencent DNS Parsing returned IP;
- User test get resolution IP;
- Users get from IP Initiate a response to resources 1.jpg Access requests for ;
- If so IP The corresponding node cache has 1.jpg, The data will be returned directly to the user (10), At this time, the request is closed
beam . If the node is not cached 1.jpg, Then, the node will send a request to the service source station 1.jpg Request (6、7、8),
After obtaining resources , Combined with user-defined configuration of the cache strategy ( Please refer to the cache time setting chapter in the user guide
Section content ), Store resources (9), And return to the user (10), The request ends .
author :ScienBeast
link :https://www.jianshu.com/p/14dede92b02f
source : Simple books
The copyright belongs to the author . Commercial reprint please contact the author for authorization , Non-commercial reprint please indicate the source .
Reference resources
CDN Principle and configuration
https://www.cnblogs.com/losbyday/p/5843960.html
https://blog.csdn.net/weixin_40555670/article/details/79344707
https://www.jianshu.com/p/14dede92b02f
https://www.xinruiyun.cn/zhishiku/3869.html
边栏推荐
- Short video mall system, how does scroll view adapt to the remaining height of the page
- Structure du disque
- Shutter precautions for using typedef
- 重磅!法大大上榜“专精特新”企业
- Description of transparent transmission function before master and slave of kt6368a Bluetooth chip, 2.4G frequency hopping automatic connection
- Chapter 10 project communication management
- 树莓派初步使用
- Raspberry pie preliminary use
- Redis-跳表
- 磁盤的結構
猜你喜欢

Docker 安装 Redis-5.0.12,详细步骤

Introduction, installation and use of postman tool

电力系统| IEEE论文投稿流程

A pit in try with resources

NiO zero copy

Genesis公链与美国一众加密投资者齐聚Consensus 2022

如何抓手机的包进行分析,Fiddler神器或许能帮到您!

嵌入式开发:技巧和窍门——干净地从引导加载程序跳转到应用程序代码
![Find the maximum value in each tree row [extension of one of the hierarchical traversals]](/img/5b/81ff20b61c0719ceb6873e44878859.png)
Find the maximum value in each tree row [extension of one of the hierarchical traversals]

How to grab the mobile phone bag for analysis? Fiddler artifact may help you!
随机推荐
电力系统| IEEE论文投稿流程
In the first year of L2, arbitrum nitro was upgraded to bring more compatible and efficient development experience
Description of transparent transmission function before master and slave of kt6368a Bluetooth chip, 2.4G frequency hopping automatic connection
Docker 安装 Redis-5.0.12,详细步骤
Can AI chat robots replace manual customer service?
Future development of education industry of e-commerce Express
Docker installs MySQL 8.0. Detailed steps
理想L9,智能座舱新潮流
Relationnet++: a representation of fusion of multiple detection targets based on transformer | neurips 2020
socket(2)
Disk structure
socket done
Unable to use the bean introduced into the jar package
Heavyweight! Fada is listed as a "specialized and new" enterprise
Principles of Ethernet port mirroring, link aggregation and VLAN Technology
Seven principles of software design
如何提取网页中的日期?
How to solve the problem that the computer suddenly can't connect to WiFi
NIO多路复用之Selector的使用
[personal experiment report]