In this lesson · topic 5 of 7
Topic 5
Weighted and latency-based answers
4 min read
Weighted routing
The authoritative server does not have to give the same answer to everyone. With weighted routing it answers with endpoint A for some share of queries and endpoint B for the rest. This is useful for sending a small share of traffic to a new version, or for moving load between regions in steps.
The weight applies to queries, not to requests. One answer is cached by a resolver and then serves every user behind it for the whole TTL. A resolver with many users sends all of them the same way.
In the lab with the weight on A set to 80 percent and a 20 second TTL, 81 percentmeasured of requests went to A. With a 300 second TTL the figure was 83 percentmeasured. Both are near the target here because 50 resolvers is a fair sample. With a few big resolvers, the split would swing much more. Treat weighted DNS as a coarse knob. A load balancer splits per request.
Latency-based routing
Latency-based routing answers with the endpoint that has the lowest measured delay for the asker’s region. The operator or provider keeps a table of delays from regions to endpoints and picks the best.
The authoritative server sees the address of the resolver, not the user. If the resolver is far from the user, the pick is for the wrong place. A protocol extension called EDNS Client Subnet passes part of the user’s address along, and not every resolver sends it.
The lab does not simulate this policy, so there are no numbers for it here. The point is the shape of the failure. The answer is as good as the signal the server has, and the cache holds it for the TTL.