当前位置:网站首页>Implementation principle of global load balancing
Implementation principle of global load balancing
2022-06-21 21:23:00 【51CTO】
author : Tianyi cloud Dengjie
Key words of this article : Global load balancing 、DNS、 Health detection
introduction :
Global load balancing refers to the load balancing among server clusters placed in different geographical locations . Server load balancing refers to load balancing the local server group . Global load balancing is mainly used to have its own server sites in multiple regions , So that global users only have one IP Address or domain name can access the nearest server , To get the fastest access speed . Global load balancing can balance the load among server clusters placed in different geographical locations . It can help enterprise services achieve high concurrent load sharing in different geographical locations 、 The user accesses the nearest access 、 Automatic isolation of service failure or remote disaster recovery .
One 、 What does global load balancing achieve ?

1、 Global load balancing is based on DNS Implementation of a set of load balancing system , The system has the basic domain name resolution function , Through the domain name requested by the user , Response to the... After the load policy calculation ip Address to client .
2、 Client access www.test.com The website of , Browser first through DNS Inquire about , Convert domain name to IP Address , And then through IP Address to access the actual web server , Complete the web page request .
Two 、 How to add a domain name DNS Request access to the global load balancing service
Usually DNS The authoritative server can direct the domain name request to another server in two ways DNS Authoritative server .
1、 The first way is through NS Record how the subdomain is authorized , Authorize the entire subdomain name to another DNS Authoritative server , Setting up www.test.com Of ns Record as ns1.gslb.ctyun.cn and ns2.gslb.ctyun.cn.
2、 The second way is through CNAME The way of recording , Set up www.test.com Of CNAME The record points to xxxxx.gslb.ctyun.cn( After the global load balancing product service is enabled , The system automatically assigns addresses ).
3、 ... and 、 The overall schematic diagram of the global load balancing business layer

1、 Load balancing component
Global load balancing mainly consists of Auth-DNS Components 、GSLB Components 、monitor Components . Their respective functions are as follows :
Auth-DNS modular : be based on DNS A simplified version of the protocol implementation authority DNS The server , Only available A Record and AAAA Records of the DNS Request service .
GSLB modular : According to various load balancing policies created by users 、pool Pool load balancing algorithm 、 and IP Health status choose the right IP Address returned to user .
monitor modular : Probe pool In the pool ip Address health status .
2、 domain name DNS Request flow
a) Auth-DNS Component receives user requests
When the end user accesses the domain name through the browser , Local DNS The domain name resolution request will be sent to DNS Recursive server ( Such as 114.114.114.114), And then pass by DNS Recursive server iteration request , Finally, the domain name resolution request will be sent to the global load balancing service Auth-DNS Components ;
Auth-DNS Component reception DNS After the request , according to RFC1035、RFC2671、RFC7871 And so on DNS Protocol parsing . obtain DNS Source in request IP Address 、 Domain name and request type , In getting the source IP Address time , priority of use edns-client-subnet The user carried by the protocol is real IP Address .
b) GSLB Select the appropriate component IP Address response to user request
First step : By domain name , Find the user subscribed GSLB example .
The second step : according to GSLB The instance can query all associated access policies , The main function of access strategy is to combine the regional information or operator information with pool Pool Association . According to the user's reality IP Address , You can select a qualified access policy policy. And start trying to use all the matching access policies policy The associated pool The address pool responds to user requests .
Access policies in the system policy With priority attribute , Give priority to using high priority access policies to respond to user requests , The priority is from high to low :
telecom - southwest - sichuan > China - southwest - sichuan > telecom - southwest > China - southwest > telecom > China > overall situation
The third step : The resource pool can select specific load balancing algorithm types , Including polling 、 Weighted polling 、 Hash 、 Random 、 priority . Try to use specific load balancing algorithm in pool Select a healthy address in the address pool IP Address response user DNS request .
If pool All in the pool IP The addresses are all unhealthy , The system will try to select pool The fallback pool that the address pool points to ( the other one pool Address pool ) Conduct IP Address selection , The selection logic is consistent with step 3 . If you still can't find the right one IP Address , The system will try to use other access policies to restart from the second part IP Address .
Step four : Will choose IP Address result , adopt Auth-DNS Components , encapsulation DNS Response message body , The reply DNS request .
c) monitor Component pair pool In the pool IP Address for health detection
monitor Component support icmp、udp、tcp、http、https Health detection methods , Each health test has its own user-defined parameters , Such as interval time 、 Timeout and other information .monitor The component will detect information according to the user configuration , Yes pool In pool IP Address for health testing , And the test results are returned to in real time GSLB Components .
monitor The component deploys detection services in multiple locations across the country , Each probe node operates independently , Have their own detection data ; The system will collect the health detection results of all detection nodes , The current version adopts the majority rule IP Is the address healthy , When think IP The number of nodes with healthy addresses is greater than that of IP Address the number of nodes that are not healthy , take IP The address is set to healthy status . Otherwise, it is set to non healthy .
Four 、 summary
Global load balancing is mainly based on DNS technology , While providing domain name resolution services , Add the source accessed by the client IP Select the nearest server for the address IP The ability of an address to respond to requests . And the global load balancing system provides user resource pool IP Address health detection function , Can be right IP Address for health detection in various ways , For abnormal IP Address in
边栏推荐
- Leecode198 looting
- LeeCode70 爬楼梯
- 十一、美化界面
- 异步方法 理解(demo附代码)
- 混合云演习常见案例
- What can one line of code do?
- About n before variables in SQL server and other usage analysis
- 【微服务七】Ribbon负载均衡策略之BestAvailableRule源码深度剖析
- F - Phone List HDU - 1671 (字典树查前缀)
- [applet] realize applet and background ASP through request Net data JSON transmission (post protocol text + code)
猜你喜欢

MySQl学习(从入门到精通 1.2)

【微服务七】Ribbon负载均衡策略之BestAvailableRule源码深度剖析

Cluster I -- LVS load balancing cluster NAT mode and LVS load balancing actual deployment

C语言回调函数到底是怎么回事?

ctfshow 105-127

异步方法 理解(demo附代码)

Introduction to high performance intranet DNS system

ADUM1401ARWZ-RL 亚德诺 数字信号隔离模块

What are the applications of 4.3-inch touch screen intelligent network central control host

Convert string type to list < integer >
随机推荐
Kubernetes-23: explain how to make CPU manager more flexible
Dedecms dream weaving background mailbox verification sending mail configuration tutorial
2022 National latest fire facility operator (intermediate fire facility operator) simulation question bank and answers
[microservices 7] in depth analysis of bestavailablerule source code of ribbon load balancing strategy
修改UE4缓存路径,缓解c盘压力
Citus 11 for Postgres 完全开源,可从任何节点查询(Citus 官方博客)
This real-time monitoring scheme is really excellent!
Libtorch video memory management example
PCA based face recognition system and face pose analysis
What are some tricks that novice programmers don't know?
这套实时监控方案,真的太顶了!
Data path: three people walk, there must be my teacher!
【yolov5】opencv450 加载onnx 进行推理 GPU 加速
ctfshow 105-127
What are the applications of 4.3-inch touch screen intelligent network central control host
How functions are declared
数据库管理:Navicat Premium 15
Cylinder function block (FB) of PLC function block series
有哪些新手程序員不知道的小技巧?
Cluster I -- LVS load balancing cluster NAT mode and LVS load balancing actual deployment