What are the limits of DNS-based routing; how do TTL and the resolver cache affect the decision?
Short answer
GTM determines only the DNS answer; it does not manage how the client stores the answer, nor the client's open connections. The given answer stays in the cache on the resolvers and on the client for the record's TTL period (default 3600 seconds); during this time, even if GTM's answer changes, the client may keep going to the old address. For this reason, it may take as long as the sum of the health check's failure detection time and the TTL for the switchover to reach the clients; a short TTL (e.g. 60–300 seconds) is recommended for records that need a fast switchover. In addition, GTM usually receives the query not from the client but from the client's resolver; location-based decisions may therefore be made according to the resolver's location.
How Does It Work?
- The target fails; GTM's health check detects this according to the Period and Required Failures settings, and the address is removed from the answer.
- The resolvers and clients that received the old answer up to that moment use the old address until the TTL expires.
- When the TTL expires, the query is made again and the new answer is received; the client connects to the new address.
Limits
| Limit | Effect | What is done in TR7 |
|---|---|---|
| Cache (TTL) | The switchover does not reach all clients until the TTL of the old answer expires | The record's TTL value is chosen between 0 and 31,536,000 seconds; a short TTL means a faster switchover, but more queries |
| Clients that do not honor the TTL | Some applications and resolvers may apply their own cache periods | There is no setting on the GTM side; it is controlled on the client side |
| Open connections | A change in the DNS answer does not move established connections | When the connection drops and is re-established, the new address is used |
| Location of the resolver | Topological Selection and Balance Algorithm → Geographic Proximity decisions may be made according to the resolver's address | If the resolver forwards the client's subnet with EDNS Client Subnet (ECS), the decision may be made according to this subnet |
| Failure detection time | The health check accepts a failure after consecutive failures | Period and Required Failures are adjusted according to the target |
Common Misconceptions
- "If TTL is set to 0, no problem remains." The answer is not cached; GTM is asked again at every resolution, and the query load and latency increase.
- "When GTM switches over, users go to the new data center immediately." The new answer is received only when a new query is made.
- "The TTL of a domain name is a single value." TTL is set per record; each record can carry a different TTL (What does a record's TTL determine; how should it be chosen in GTM?).
How it is done in the documentation
Related questions
