Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
net: DNS load balancing during bursts of traffic #31698
Right now inflight DNS lookups are grouped together.
Since DNS resolution picks the first available IP, this has the side effect of resolving the same IP when there are bursts in traffic.
This was surprising to me since I expected load to be distributed amongst the resolved hosts, especially during these bursts (assuming equal RFC 6724 weighting).
Load distribution via DNS seems like a common use case/expectation - it would be nice to be able to enable randomized DNS resolution. Being able to disable DNS query grouping or customize the way the group key is generated would also work.
Randomizing each member of a singleflight group seems like it will require some amount of refactoring. For one, whether or not a request was in a group is entirely encapsulated by singleflight. Also, at the point singleflight is used, the addresses are already sorted by RFC6724.
So the grouping/randomization should be done before we apply the RFC6724 sorting rules and there needs to be a way to know whether a request was grouped by singleflight.
 Another option is to randomize the resolved addresses and sort again by RFC6724 instead of moving where singleflight is called