Which distribution algorithms are available between several addresses in a record?
Short answer
In a record, which of the healthy addresses that can be included in the answer are returned is determined by the record's Balance Algorithm field. There are nine options: All Records (default), First Healthy Record, First 2 Healthy Records, First 3 Healthy Records, Round Robin, Weighted Round Robin, Random, Weighted Random and Geographic Proximity. The algorithm is applied only to the addresses that pass health filtering and the operating mode; in the two weighted options, a Weight (default 1) is entered for each address. Geographic Proximity works only on A and AAAA records; on other types it behaves like All Records.
How Does It Work?
The algorithm is the third step in forming the answer: first, unhealthy and Disabled addresses drop out according to the HC condition, then the operating mode determines the candidate addresses, and finally the algorithm builds the answer from these candidates (record resolution logic).
| Option | Returned in the answer |
|---|---|
| All Records | All healthy addresses. |
| First Healthy Record / First 2 Healthy Records / First 3 Healthy Records | The first 1, 2 or 3 healthy addresses in the order. The order is the address order in the form; in Datacenter mode, the selection order of the data centers applies first, then the order within the group. |
| Round Robin | Healthy addresses are distributed in turn across queries. |
| Weighted Round Robin | Distribution in turn, according to the Weight values of the addresses. |
| Random | Random selection from the healthy addresses. |
| Weighted Random | Random selection, according to the Weight values of the addresses. |
| Geographic Proximity | The healthy address geographically closest to the client; only on A and AAAA records. |
When no healthy address remains, the algorithm does not come into play; if there are any, Fail-Safe Records are returned.
Balance Algorithm in TR7
- The algorithm is selected per record in the Balance Algorithm field of the record form; if the field is left empty, the record is saved with All Records. In the SOA record, the algorithm is always First Healthy Record.
- When Weighted Round Robin or Weighted Random is selected, the Weight column is added to the Record / HC table.
- The addresses the record returns at that moment are seen in the Active Records row of the record preview, and the algorithm of the records in the Balance Algorithm column of the Records list.
- To define rules by location, Topological Selection, which is a separate feature, is used (What is Topological Selection; how does GTM determine the client's location?).
Common Misconceptions
- "Weighted Round Robin splits the traffic exactly in the ratio of the weights." The algorithm distributes DNS answers; because resolvers keep the answer in their cache for the TTL period, the clients behind them use the same address and the actual traffic ratio can deviate from the weights (What are the limits of DNS-based routing; how do TTL and the resolver cache affect the decision?).
- "When All Records is selected, GTM balances the load across the addresses." All healthy addresses are returned in a single answer; the client decides which one to connect to.
- "Geographic Proximity works on every record type." It works only on A and AAAA records; on types such as CNAME and MX, it behaves like All Records.
- "These algorithms are the same as the Load Balancer algorithms." The GTM algorithm selects the addresses in the DNS answer; the distribution of connections to the servers is done by the vService's algorithm (Which load balancing algorithms are supported?).
How it is done in the documentation
