This tutorial demonstrates the Global Server Load Balancing (GSLB) feature in OpenResty Edge. You will learn how to distribute your traffic among different gateway clusters based on various indicators, such as load average, latency, and bandwidth.

View load balancing plans

Let’s go to the OpenResty Edge’s Admin web console. This is our sample deployment of the console. Every user has her own deployment.

Screenshot

Go to the DNS management page.

Screenshot

Go to the “GSLB” page.

Screenshot

Select “Plans”.

Screenshot

We can observe here the traffic status after activating the global server load balancing.

This pie chart displays how the current traffic is distributed among different network clusters in real-time.

Screenshot

As shown, this cluster handles the highest amount of traffic.

Screenshot

This is the traffic distribution of the previous plan.

Screenshot

You can see that in the cluster ali yun-beijing, the traffic distribution of the previous plan was 52% and 48%.

Screenshot

And the current distribution is 50% and 50%.

Screenshot

This is the origin plan, the first plan of GSLB.

Screenshot

This is the current plan. It will be updated periodically.

Screenshot

When the traffic distribution or plan on the left is inconsistent with the GSLB plan on the right,

the plan on the right side will be highlighted in color red and green.

Screenshot

Green indicates an increase, while red indicates a decrease.

Screenshot

Click on the previous plan.

Screenshot

And the next plan. You can browse historical plans.

Screenshot

The GSLB configurations

Next, let’s take a look at the GSLB configuration.

Screenshot

You can use this button to enable or disable GSLB.

Screenshot

Screenshot

This is the update interval of the plan. It means that the plan will be updated every 60 seconds.

Screenshot

Here you can set the number of results that will be returned in the DNS query.

Screenshot

Edit each Edge Node to adjust the traffic flow

Next, we will look at how to configure each Edge Node.

Click the edit button to enter edit mode.

Screenshot

You can use the drop-down list to select the indicators that will determine the DNS results. This will help you adjust the traffic flow in the system.

Screenshot

For example, select “load average in last 1 minute”

Screenshot

The traffic will be adjusted based on the calculated probability when the indicator reaches the lower threshold.

Screenshot

DNS resolution does not return any information about this node anymore when the indicator reaches the upper threshold.

Screenshot

That’s what I’d like to cover today.

If you like this tutorial, please subscribe to this blog site and/or our YouTube channel. Thank you!

About The Author

Yichun Zhang (Github handle: agentzh), is the original creator of the OpenResty® open-source project and the CEO of OpenResty Inc..

Yichun is one of the earliest advocates and leaders of “open-source technology”. He worked at many internationally renowned tech companies, such as Cloudflare, Yahoo!. He is a pioneer of “edge computing”, “dynamic tracing” and “machine coding”, with over 22 years of programming and 16 years of open source experience. Yichun is well-known in the open-source space as the project leader of OpenResty®, adopted by more than 40 million global website domains.

OpenResty Inc., the enterprise software start-up founded by Yichun in 2017, has customers from some of the biggest companies in the world. Its flagship product, OpenResty XRay, is a non-invasive profiling and troubleshooting tool that significantly enhances and utilizes dynamic tracing technology. And its OpenResty Edge product is a powerful distributed traffic management and private CDN software product.

As an avid open-source contributor, Yichun has contributed more than a million lines of code to numerous open-source projects, including Linux kernel, Nginx, LuaJIT, GDB, SystemTap, LLVM, Perl, etc. He has also authored more than 60 open-source software libraries.