Selecting n Number of Pool Members from m Number of Pools
When a query lands on a GSLB service, the load balancing algorithm for GSLB will be applied and the required number of pool members will be fetched from the specified number of pools. This article helps you understand how to select n pool members from m pools and the DataScript functions to achieve this.
Selecting n Records from m Pools
Consider a scenario in which if the GSLB service algorithm was geolocation based, and the distribution of pool members is as follows:
- US-West-Coast - 4 pools
- US-East-Coast - 5 pools
- London - 2 pools
In this scenario, the DNS virtual service hands out IP addresses of members in the best applicable pool.
A client from the US west coast would get a member from US-West-Coast. If the number of IP addresses was set to a non-zero value, then the client gets multiple members from US-West-Coast.
However, in certain cases, there is a requirement to send multiple IP addresses from multiple pools. For example, two addresses each from US-West-Coast and US-East-Coast respectively.
Starting with Avi Vantage release 18.2.5, selecting n records from m GSLB pools is supported via the DataScript function
With the DataScript attached to the DNS virtual service, it is possible to select m number of pools. From these, n number of members are selected.
Note: If the pools are of the same priority or in the same geolocation, then the pools that are fetched will be in round robin. To get consistent entries every time, the pools must be configured with unique priorities and the load balancing algorithm of the pool members should be consistent hash.
In addition to this, the following DataScript functions are also supported:
|avi.gslb.add_records(m)||Adds m records to be added from all pools
If m > total pool members, all the pool members are returned.
If m = 0 or n = 0, m or n is treated as the maximum available pools or pool members respectively.
Bind the DataScript to the DNS virtual service as shown below:
admin:demo-ctrl]: configure virtualservice *DNS_VS_name* admin:demo-ctrl]: virtualservice> vs_datascripts index 1 vs_datascript_set_ref *name_of_datascript* admin:demo-ctrl]: virtualservice> save