How does DNS-based traffic management work; when is the decision made?
Short answer
In DNS-based traffic management, the routing decision is made before the client establishes a connection, with the answer given to the domain name query: whichever address GTM returns, the client connects there. The decision is formed at two points in time. The health of the addresses and of the data centers is measured continuously in the background, and when a status changes, the candidate addresses of the record are recalculated; when a query comes, the answer is selected from these candidates according to the Balance Algorithm and Topological Selection settings of the record. The answer given stays in the cache on the resolvers and on the client for the TTL period of the record; during this period, GTM is not asked again.
How Does It Work?
- The client asks its resolver for the domain name.
- Through NS delegation, the resolver asks GTM's DNS Service, which is the authoritative server of the domain name.
- GTM produces the answer from the current candidate addresses of the record. If no candidate remains, the Fail-Safe Records are returned.
- The resolver stores the answer for the TTL period and forwards it to the client.
- The client connects directly to the address; the subsequent traffic does not pass through GTM.
When Is the Decision Made?
| When | What is determined |
|---|---|
| In the background, when the health status or the data center information changes | Whether the addresses are considered healthy according to the HC condition; in Disaster Recovery mode, the switchover between the Main DC and the DR DC; in Datacenter mode, the order of the data centers according to the DC Selection metrics and the Total DCs to Select from cut |
| On every query | The selection made with the Balance Algorithm options Round Robin, Weighted Round Robin, Random, Weighted Random and Geographic Proximity (on A and AAAA records); the Topological Selection rules being applied according to the client; the Client Based selection in DC Selection |
While Topological Selection is off, with algorithms such as All Records and First Healthy Record, the answer is the same on every query until the next status change. The health status is determined per address with Health Scenarios; the order of the steps is in the Record Resolution Logic section of the docs.
In TR7
- Which addresses the record returns at that moment, and its status (OK, DR, Fail-safe, No healthy records …), are seen in the Records list and in the preview of the record.
- Status changes and switchovers are written to the GTM Logs screen.
Common Misconceptions
- "GTM checks the targets again on every query." Health Checks run in the background independently of the queries; at the moment of the query, the status measured up to that moment is used.
- "GTM sees the client's own address." The query is usually brought by the client's resolver; for this reason, location-based decisions may be made according to the resolver (What is Topological Selection; how does GTM determine the client's location?).
- "When the answer changes, clients go to the new address immediately." The previous answer stays in the cache until the TTL expires (What are the limits of DNS-based routing; how do TTL and the resolver cache affect the decision?).
How it is done in the documentation
