How does weighted DNS routing work, and how precise is it?
Sketch your own answer first, then compare it with the one below.
A strong answer
The authoritative server answers each query with endpoint A or B in set proportions. It is used to send a small share of traffic to a new version or to move load in steps.
It is coarse. The weight applies to queries, and a resolver caches its answer and serves every user behind it for the TTL. A large resolver sends all its users one way. With many resolvers and a short TTL the split comes close to the weight. With few large resolvers or a long TTL it can be far off.
For a precise split by request, use a load balancer or a service mesh.
Sources
- Paul Mockapetris (1987). RFC 1034: Domain Names, Concepts and Facilities.