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.
The text was updated successfully, but these errors were encountered:
It does not make sense to me to start doing a separate DNS query for each connection. But perhaps if the DNS query returns multiple addresses, we could arrange for each member of the singleflight group to get a randomly chosen address.
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