Estimated Reading Time: 4 minutes|Last Updated: 11/3/2021, 10:50:40 AM

# Enable DNS Global Server Load Balancing

GSLB(Global Server Load Balancing) is a DNS redistribution function that intelligently distributes traffic among multiple server clusters. GSLB combines each server's availability, distance, system load, RPS, and connection count metrics to direct user requests to the most appropriate server via DNS response.

Select DNS/Global Server Load Balancing, after selecting Enabled you need to configure these parameters.

# Global Configuration
  • Plan update interval: Global server load balancing plan update interval.
  • Max number of DNS results: Limit the number of DNS resolution records. If the number of resolution records returned is greater than the limit, those that exceed the limit will not be returned.
# Node Configuration
  • Metric: Load balancing reference metric, (if you do not select the metric, then the DNS configuration will be in accordance with the answer, will not be redistributed)
    • load_1m: The average load value of the current node over 1 minute
    • load_5m: The average load value of the current node over 5 minutes
    • load_15m: The average load value of the current node over 15 minutes
    • rps: The number of requests per second processed by the current node
    • active_conns: Number of active connections to the current node
  • Low Watermark: When the metric of the node exceeds the low water level, the flow is distributed to other nodes according to the probability
  • High Watermark: When the metric of the node exceeds the high water level, the flow will no longer be distributed to this node

After the above configuration is completed, Admin will generate the load balancing plan according to the actual node metrics and send it to each node regularly according to the update interval.

# View Load Balancing Plan

Once the global load balancing plan is generated, these charts can be seen in the plan list.

Total Traffic Distribution is the distribution of network traffic (network ingress and egress traffic) for each cluster.

The left side contains two types of diagrams.

Traffic Distribution shows the real traffic distribution of each cluster node.

Original DNS Plan shows the traffic distribution without GSLB and only according to DNS resolution results.

The GSLB Plan on the right is the generated load balancing traffic distribution.

If there is a difference in the cluster node traffic distribution between the right chart and the left chart, the arrow color will show red or green, representing a decrease in traffic inflow to that node and an increase in traffic inflow to the node, respectively.

Click Previous Plan and Next Plan to also view the previous plan history.

# Example

Here we use our mini-CDN Beijing gateway cluster as an example. Before configuring the metrics, the traffic distribution of the two nodes is approximate.

Assuming that the performance of Beijing node 2 (127.0.0.3) is low and can only handle a small number of requests, we using rps as the reference metric of the node and adjust the high watermark of Beijing node 2 to a low value.

Waiting for the plan update, after a period of time, we can find that the load balancing has taken effect and the traffic of the second node has started to drop, most of the requests will go to Beijing node 1 (127.0.0.2) and some requests will also go to Hangzhou node (127.0.0.1).

We add a DNS record: www.test.com, which resolves to the Beijing gateway cluster.

Use the dig command to requests www.test.com 1000 times, and we can see that the resolved distribution results are approximate to the results in the global server load balancing plan.


[root@fedora28 ~/orinc/ 0 ]$ for i in {1..1000}; do dig www.test.com @127.0.0.1 +short; done | sort  | uniq -c
    168 127.0.0.1
    832 127.0.0.2