大家好,又见面了,我是你们的朋友全栈君。
最近看到一篇关于GSLB的文章,写的非常不错,学习了一下,这里做一些记录。
一、GTM介绍
GTM(Global Traffic Manager的简写)即全局流量管理,基于网宿智能DNS、分布式监控体系,实现实时故障切换及全球负载均衡,保障应用服务的持续高可用性。GTM基于资源的健康状况及流量负载做智能调度决策,为用户提供最佳访问IP。网宿GTM,提供更可靠、稳定和安全的流量调度服务,助您轻松构建混合云应用。
GTM原理
GTM是应用DNS向用户返回最佳访问IP,但是与DNS所不同的是,它对所有资源进行健康检查,一旦发现故障就从DNS返回IP中剔除;它还根据调度策略进行决策,保障资源的高可用性。
网宿GTM核心功能有:健康检查、资源管理、调度策略管理。
健康检查:
网宿GTM提供ping、tcp、http(s)三种方式的健康检查,依靠网宿强大的监控系统,应用智能选点技术,为调度决策提供可靠的基础数据。
资源管理:
主备负载均衡、负载均衡的两种资源管理模式,添加资源支持IP、CNAME两种方式的负载比例。GTM主要通过资源来进行多地数据中心的管理,用户可以创建多级主备资源,资源可以是IP或 CNAME域名。如主资源添加1.1.1.1,2.2.2.2,一级备添加3.3.3.3,4.4.4.4,二级备添加5.5.5.5…
调度策略管理:
按负载权重、地域或运营商属性来进行流量分配,不同的资源分配不同比例的流量,当资源发生故障时,可自动或手动切换至正常的资源,保障资源持续可用。
调度策略丰富多样,不仅支持自定义线路配置,支持主备负载均衡,还支持线路智能调度、动态比例智能切换,这些特性让GTM能够灵活快速的构建同城多活和异地容灾服务。
GTM产品架构:
访问流程:
① 用户终端浏览器输入的URL,例如http://www.example.com,浏览器发送域名解析请求到本地DNS服务器解析;
② 本地DNS服务器发送域名解析请求到网宿授权DNS服务器(即GTM系统);
③ GTM系统根据预定策略,分析请求IP,返回最佳的解析结果(如同运营商,同区域等);
④ 本地DNS服务器得到最优的IP,返回给用户;
⑤ 用户得到网站IP地址,向网站发出访问请求;
⑥ 网站根据用户的请求,返回内容给用户;
⑦ GTM系统实时监控源站资源的情况等,并在系统出现故障时,及时调整,保障服务可用。
GTM特色功能
1.线路智能调度
线路智能调度实现不同线路间调度,最大化保障资源服务可用性。当默认线路全部故障时,自动调度其他可用的线路资源;当低级线路故障,解析切换至上一级可用线路。
2.动态负载均衡
对用户的资源进行健康检查,通过网宿健康质量评估模型对各个资源评分,按照质量评分结果动态调整负载比例,保障用户的最佳访问体验。一个周期内,资源越健康,质量分越高,此时资源的负载权重也会增加;反之,资源可用性低,质量分越低,资源的负载权重将会被调低。
3.智能选监控点
根据最优监控点模型,智能选择监控节点,保障数据采集的快速准确。由用户自主选取监控点时,以下的条件会让客户选择起来比较困难:a.本身系统提供的监控节点数量多、区域分散、所属运营商多;b.主机资源故障告警和策略主备调度的及时性必须基于监控节点合理,因此要求监控节点所属区域运营商需与DNS解析线路接近,且监控节点数量要合理。智能选点能够解决上述问题,选择与资源、线路最接近,且性能最优的监控点,为调度决策提供有效的数据依据。
4.高防抗D
网宿公司在DNS技术方面有深厚的积累,可以有效防护诸如SYN flood、UDP flood、ICMP flood等多种类型的 DDOS 攻击。同时,网宿拥有优质的骨干节点资源,具备防御超大流量的DDOS攻击及DNS Query查询攻击能力,保护网站远离DDOS攻击困扰,极大地增强了防攻击的能力。GTM是基于DNS解析的一大重要功能提升产品,防御能力更加强大。
5.调度报告可视化
GTM为用户提供了解析量地域分布报表、解析量报表、月度资源调度报告等报表数据。提供国内主要省份,主要运营商和海外七大洲的地域分布数据,帮助用户运营推广区域的考虑奠定基础。结合调度报告可快速的掌握集群健康状态,服务可用性情况,以及服务提供的主机状态,为优化域名的服务提供数据基础。
GTM应用场景
场景一:主备IP容灾
客户网站是由多个源站(或数据中心)进行服务支撑时,使用主备智能切换可以确保服务高可用。简单说,有两个IP地址A(主)和B(备),正常情况下,用户访问IP地址A、当IP地址A故障后,用户将不再访问到IP地址A,而是访问到IP地址B。
场景二:多级备份
客户网站是由多个数据中心进行服务支撑时,根据实际情况进行备份分级,实现有线同城备份,再次异地备份。
场景三:高并发下的负载均衡
用户量大,或者用户突增(如年中大促、双十一、618促销等)情况下,需要对源站多个IP配置负载均衡,避免源站崩溃。通过网宿GTM,只需要配置调度策略,即可实现权重负载均衡。假设源站有多个IP地址A,B,C,D,A、B设为主源,C,D作为备源,A的性能最佳,主源A,B的负载比例可设为3:2,即A的负载为60%,B的负载为40%,当主源全部故障时,备源将启用,当主源恢复时,切回主源。
场景四:CDN智能互备
当客户网站有使用多个CDN服务商时,通过全网融合流量分配解决方案可实现CDN之间的互备。
二、GSLB(Global Server Load Balancing)介绍
Advantages of GSLB over Traditional DNS Methods
In an environment where servers are distributed in Korea (KR) and US (US) sites (data centers), the left side shows a round-robin based DNS method and the right side shows a GSLB based method.
1.Disaster Recovery
- [DNS Method] Because DNS server does not know the health status of the application server (live or dead), 50% of users (because of Round-Robin DNS) are down servers even if the US site server is down as shown in the figure. While making a connection request,
- [GSLB Method] The GSLB server can monitor the health status of application servers periodically to prevent users from connecting to down servers.
2. Site Load Balancing
- [DNS Method] Since the DNS server cannot know the load status of the application server, 50% of the users will make a connection request to the overloaded server even if the load on the Korean site server exceeds the threshold as shown in the figure. On the other hand,
- [GSLB Method] The GSLB server can check the load status of the application server periodically to prevent users from connecting to the overloaded server.
▶ Translator Note : It is not exactly checking the application server load but rather the status of SLB load (currently available sessions, network usage, etc.).
3. Network Proximity
- [DNS] DNS server cannot measure round trip time (RTT) of network section between user and application server, so it is impossible to select server considering current network status.
- [GSLB Method] The GSLB server allows users to connect to a server with a fast response (good network condition) through RTT measurement of the network segment between the user and the application server.
▶ Translator Note : It is not precisely measuring the RTT between the user and the application server, but the RTT between the local DNS server (the DNS server configured in the user terminal) and the SLB (described in the next section).
4. Geographic Proximity
- [DNS Method] DNS server cannot select application server considering user’s geographic location, but user in Korea may be connected to US site server.
- [GSLB Method] The GSLB server can select an application server considering the user’s geographical location so that the user can connect to the server that is geographically closest.
▶ Note: In general, because the RTT is small when geographically close, the results of times 3 and 4 are often the same, but in the case of Network Failure / Congestion, different results may be obtained.
In this geographically dispersed server environment, GSLB provides the following benefits:
(1) Service Availability (Disaster Recovery)
(2) Server / Site Load Balancing
(3) Low Latency by Network Proximity
(4) Nearest Access (Nearest by Geographic Proximity)
GSLB service logic, 这个图很详细
Global Server Load Balancing (GSLB) is an evolution of Server Load Balancing (SLB) .If an SLB provided L4 switching within a site, it provided server health checks (dead or live?) And load balancing. GSLB extends this concept geographically to provide the same functionality across multiple sites.
■ Configuration
- Of the four www.example.com web servers, two are located in Korea (KR) and two in the US (US)
- SLB is located in front of each site’s web server so that users can request access to the SLB’s Virtual IP address (1.1.1.1, 2.2.2.2), not the www.example.com web server’s IP address (10.1.1.10 ~ 13). , SLB translates the destination IP address and forwards it to the web server
- GSLB and example.com DNS server are located at the Korean site
- The user sends a DNS Query to the local DNS server to access www.example.com. The local DNS server passes through the root DNS and .com DNS servers.
- Send a DNS Query for www.example.com to GSLB.
- GSLB acts as a DNS proxy, thus forwarding this DNS query to the example.com DNS server.
- The example.com DNS server is pre-registered with the 1.1.1.1 and 2.2.2.2 IP addresses for the www.example.com (SLB’s Virtual IP), and forwards the values to GSLB. Assume that the TTL is 300 seconds on delivery.
- GSLB has its own policy (described later) to determine the best site for users during 1.1.1.1 and 2.2.2.2, and also change the TTL to a small value (eg 10 seconds). Changing the TTL value is intended to cause the Local DNS server to cache binding information (IP address for www.example.com) for a minimum of time.
- Web server IP 1.1.1.1 determined by GSLB Policy (or changed the order of IP address list to 1.1.1.1, 2.2.2.2) and changed TTL value are transferred to Local DNS.
- Local DNS sends the value to the user’s device.
- The user now sends an HTTP GET to the Korean site SLB1 with the IP address 1.1.1.1 of www.example.com, and SLB1 again applies its own policy (considering server health / load, etc.) Forwards an HTTP GET message.
GSLB’s site / server selection policy is shown below. Today I will show you a picture and explain it next time.
GSLB Policy
5.SLB Connection Load
If you did not select a site in the last 4 lessons (Selecting a Geographic Proximity-based site), select a site with a low connection load on the SLB . SLB Connection Load means “average number of new connections per second on the site, over a given number of intervals). For example, if the SLB period is set to 5 seconds, and each second has 100, 110, 120, 130, 140 new connections, the SLB Connection Load is (100 + 110 + 120 + 130 + 140 ) / 5 seconds = 120.
- SLB1 and SLB2 periodically report their current connection load to GSLB on Korean and US sites.
- When a user sends a DNS Query to a local DNS server
- Local DNS server forwards DNS Query to GSLB (omit DNS Proxy for convenience of explanation),
- GSLB selects a site based on the current Connection Load of SLB1 and SLB2. For this purpose, a threshold for Connection Load is set in SLB / GSLB. The current connection load of the Korean site SLB1 is 120, beyond the threshold = 100, while the US site SLB2 is 80. Therefore, GSLB responds with a 2.2.2.2 address (Virtual IP) 2.2.2.2 from the US site SLB2, which does not exceed the threshold.
- Local DNS server that receives the DNS response delivers the value to the user.
- The user makes an HTTP GET request to SLB2.
- Upon receiving it, SLB2 chooses between Servers 3 and 4 and forwards the HTTP GET to that server, depending on the policy (considering server health / load status, etc.).
6. Site Preference
If both sites’ SLBs do not exceed the Connection Load threshold and fail to select a site in Step 5 (select a site based on SLB Connection Load), the site is selected by the Site Preference value (site affinity) set by the operator . The operator sets a preference value for each site (by SLB) in GSLB, and GSLB always chooses a site with a large value.
- When a user sends a DNS Query to a local DNS server
- Local DNS server forwards DNS Query to GSLB (omit DNS Proxy for convenience of explanation),
- GSLB refers to site-specific preferences set by the operator. The operator set the Preference value of the US site to 255 during the time when the service was not available due to the expansion of the server / network at the Korea site. Therefore, GSLB responds by putting the 2.2.2.2 address (Virtual IP) 2.2.2.2 of the US site with large Preference value in DNS Response.
- Local DNS server that receives the DNS response delivers the value to the user.
- The user makes an HTTP GET request to SLB2.
- Upon receiving it, SLB2 chooses between Servers 3 and 4 and forwards the HTTP GET to that server, depending on the policy (considering server health / load status, etc.).
7. Least Selected
If both sites are set to the same Preference and no site selection is made in Step 6 (site preference based site selection), select the least selected site as a way to balance the site load .
- When a user sends a DNS Query to a local DNS server
- Local DNS server forwards DNS Query to GSLB (omit DNS Proxy for convenience of explanation),
- GSLB refers to the selection ratios of Korean and US sites. So far, we have chosen 40% Korean sites and 60% US sites for all user requests. Therefore, GSLB responds by putting the 1.1.1.1 address (Virtual IP) of the Korean site SLB1, which had few site selections, in the DNS Response.
- Local DNS server that receives the DNS response delivers the value to the user.
- The user makes an HTTP GET request to SLB1.
- Upon receiving it, SLB1 chooses either Server 1 or 2 to forward HTTP GETs to that server, depending on the policy (considering server health / load status, etc.).
8. Static Load Balancing
Steps 7 and 8 are the final choices in which only one of them can be used. Step 8 selects the site by Round-Robin or Weighted Round-Robin method . In case of Round-Robin, select the site in the order of Korea-> USA-> Korea-> USA … In case of Weighted Round-Robin method, if the ratio of weight value between Korea and USA is 2: 1, Korea- > South Korea-> United States-> Korea-> Korea-> United States … in order to select twice as many sites. (E.g. more servers in Korea)
- When a user sends a DNS Query to a local DNS server
- Local DNS server forwards DNS Query to GSLB (omit DNS Proxy for convenience of explanation),
- GSLB selects sites in round-robin or weighted round-robin mode. In this example, GSLB selects the US site and responds with the DNS response with the 2.2B address (Virtual IP) 2.2.2.2 from SLB2.
- Local DNS server that receives the DNS response delivers the value to the user.
- The user makes an HTTP GET request to SLB2.
- Upon receiving it, SLB2 chooses between Servers 3 and 4 and forwards the HTTP GET to that server, depending on the policy (considering server health / load status, etc.).
So far, we have learned about GSLB in four episodes.
The advantages of the GSLB solution can be summarized into three major categories:
(1) site redundancy
(2) site load balancing
(3) provide users with the best site (faster or closer to responding)
GSLB solutions are applicable to global companies, Internet portals / Internet content providers (CSPs), cloud service providers, and CDN service providers that serve their customers worldwide.
参考:
Enterprise를 위한 GSLB(Global Server Load Balancing) – 1편: 개념 및 서비스 로직 | NETMANIAS
Enterprise를 위한 GSLB 서비스 – 2편: Site/Server 선택 정책 (2) | NETMANIAS
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/135617.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...