当前位置:网站首页>A little understanding of GSLB (global server load balance) technology
A little understanding of GSLB (global server load balance) technology
2022-07-04 05:45:00 【Day by day】
gslb(global server load balance) A little understanding of Technology
Preface
For larger Internet companies , Users may be all over the world , here , To enhance the user experience , Companies usually set up computer rooms close to users , To serve the requests of these users .
For example, wechat mainly serves domestic , In China, there will be a large number of computer rooms in many cities to serve domestic users , in addition , Because in North America 、 There are users in Europe , therefore , There will also be corresponding computer rooms in Europe and North America .
here , As a service provider , Naturally, I hope users can visit nearby , Guangdong users visit Shenzhen computer room , North American users visit the North American computer room .
How to do this , For example, everyone visits at the same time www.qq.com, How to ensure the nearest visit ?
This is it. gslb(global server load balance) The stage of .
gslb Implementation scheme of dns
dns programme , It should also be the most mainstream solution , We can think about it first , visit www.qq.com when , What will you do ? First of all, get the name behind the domain name ip, There will be dns recursive query .
User dns request , First enter the local dns The server , For example, my side is Shenzhen Telecom broadband , Theoretically, it entered Shenzhen Telecom dns The server , This is what we call localDns localDns I'll check root dns The server ,root dns The server only maintains the top-level domain name dns Server address , So it will return .com This top-level domain name corresponds to dns The server ( Write it down as tld, namely top level domain Top-level domain server ) localDns Next , towards .com The top-level domain name server initiates a request , It will return resolvable qq.com Domain name dns The server ( It is called authoritative server ) localDns Next , towards qq.com Domain name dns Server initiates request , It will parse www This host corresponds to ip, And back to localDns Get www.qq.com Of ip after , Return to the user .
You can read pictures directly without reading words .
however , One thing you should remember , From beginning to end , All are localDns Helping us run around , So our agent , In the process ,root、tld dns The server 、 Authoritative server , Are only with localDns Dealing with , Completely unaware of the existence of our users , therefore , One thing is very important ,root、tld dns The server 、 Authoritative servers only know localDns Of ip, Without knowing our users ip.
Now we know , Ultimately, I am responsible for qq.com Server's dns server To help us analyze the behind ip, The problem is coming. , This dns server Can you help us to access nearby , The answer is , not always , This is usually for www.qq.com Configure multiple A Record , That is, multiple machine rooms ip, Such as Shenzhen computer room ip、 North American computer room ip, This dns The server is not very intelligent , It returns pollingly ip, That's probably , North American users got the domestic computer room ip, Then how to play , It's jammed .
The problem is , This dns The server is not very intelligent , Can't meet our personalized needs , What shall I do? , There are solutions , You can see the picture below .
Here you can give www.qq.com To configure ns Record , Let it point to another dns service , And this dns service , We can achieve one by ourselves , Nothing more than writing a background service , Open a port , receive dns request , Correct implementation dns Agreement is enough ,gslb It's such a customized dns service .
“NS representative “ Domain name server ”, The domain name server record indicates which DNS The server does not respond to this request Domain Authoritative ( namely , Which server contains the actual DNS Record ). Basically ,NS The record tells the Internet where to find the domain IP Address . A domain usually has multiple NS Record , These records can indicate Primary and secondary domain name servers . If not configured correctly NS Record , Users will not be able to load websites or applications .
Here's a NS Record examples :
”
example.com record type: value: TTL @ NS ns1.exampleserver.com 21600
It is introduced. gslb after ,dns analysis , It becomes such a process .
localDns The previous steps are similar , The difference is , To qq.com Domain name dns After the server initiates the request ,qq.com Domain name resolution www.qq.com, Find out www.qq.com Configured with ns Record , here , It will return ns In record value to localDns, And this value, It points to Tencent itself gslb service localDns To Tencent gslb Service initiated request , Be careful , As we have said , At this point udp dns Inquire about , client ip yes localDns Of ip,gslb The server will only get localDns Of ip, such as , Take me for example ,gslb Can't get mine ip, Only Shenzhen Telecom ip. gslb Upon receipt of the request , Theoretically available data include : Which country does the request come from , The requested ip The operator , The requested ip Province and city , Such as China - Shenzhen - telecom , here ,gslb You can choose to return to Shenzhen machine room ip to localDns, Instead of the North American computer room ip, In this way, the nearest access is achieved
gslb Realization
I took a look at Tencent , Should be 06 I made this thing in , I don't know the specific implementation , Just refer to the open source framework , But I guess , It may be based on bind This open source dns Parser to change , After all, now the mainstream dns service , Mainly bind、dnsmasq, I want to practice this these two days gslb, I also built a bind( But I finally found that I couldn't parse my own bind Service , Read the description of the domain name resolver , It seems that you can't ns The record points to my privately built dns service )
Generally, big factories must have their own gslb Realized , I also saw relevant in Ctrip's technical article gslb Technical description .
Suppose we were in a small factory , No self-study ability , So what ?
Actually ,dns Analyzers still have advanced capabilities , Is my low 了 , This is very simple , As long as the cash capacity , You can solve it .
With what I use now dnspod For this parser , By default, it supports several routes , Like telecommunications 、 Move , Different directions can be configured ip.
I understand , What about the big factory , It should have this research and development ability , Unwilling to spend this unjust money , After all , When the company was small , Rent cheap , After growing up , More than one domain name , Compared with self-study , It may not be cheap ; And if you study by yourself , It can also be combined with business depth , Make some flowers to live .
summary
You can also share your views ,gslb To achieve this part , It's all my nonsense , however dns Analytic quotient , What is provided is gslb An implementation of
边栏推荐
- 1480. Dynamic sum of one-dimensional array
- VB.net 调用FFmpeg简单处理视频(类库——6)
- 19. Framebuffer application programming
- Luogu deep foundation part 1 Introduction to language Chapter 5 array and data batch storage
- 总线的基本概念
- LM small programmable controller software (based on CoDeSys) note 22: error 4268/4052
- Penetration tool - sqlmap
- Programmers don't talk about morality, and use multithreading for Heisi's girlfriend
- transformer坑了多少算力
- Leakage detection relay jy82-2p
猜你喜欢
BUU-Crypto-[GXYCTF2019]CheckIn
Steady! Huawei micro certification Huawei cloud computing service practice is stable!
ansys命令
补某视频网站的js,进行视频解密
VB.net GIF(制作、拆解——优化代码,类库——5)
复合非线性反馈控制(二)
【雕爷学编程】Arduino动手做(105)---压电陶瓷振动模块
Google Chrome browser will support the function of selecting text translation
One click filtering to select Baidu online disk files
Halcon图片标定,使得后续图片处理过后变成与模板图片一样
随机推荐
冲击继电器JC-7/11/DC110V
LC weekly 300
[MySQL practice of massive data with high concurrency, high performance and high availability -8] - transaction isolation mechanism of InnoDB
tutle时钟改进版
卸载Google Drive 硬盘-必须退出程序才能卸载
Thread pool: use thread pool to optimize query speed
[Excel] 数据透视图
ansys命令
每周小结(*63):关于正能量
Upper computer software development - log information is stored in the database based on log4net
Signification des lettres du module optique et abréviation des paramètres Daquan
Gridview出现滚动条,组件冲突,如何解决
How to use postman to realize simple interface Association [add, delete, modify and query]
(4) Canal multi instance use
配置交叉编译工具链和环境变量
简易零钱通
【雕爷学编程】Arduino动手做(105)---压电陶瓷振动模块
BUU-Reverse-easyre
BUU-Pwn-test_ your_ nc
Flask