-
Notifications
You must be signed in to change notification settings - Fork 36
Endpoint weighted selection algorithm fails if weights are 0 #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
…gorithm. This clarifies language as mentioned in w3c#153.
The change in #154 brings us closer to the semantics of a But this makes me realize that Let's say you have two endpoints, A and B, with weights 1 and 2. My intuition would be that endpoint B is always chosen twice as often as endpoint A. But RFC 2782's algorithm would mean that each client is either (a) three times more likely to choose endpoint B, or (b) equally likely to choose A or B! And both (a) and (b) happen with equal probability:
I'm not sure how I feel about this. If we want to strictly follow the |
/cc @sburnett |
Is there a good reason to allow endpoints with weight 0 to be selected in the presence of non-0 endpoints? As I commented on @sburnett's Chromium patch, it seems like the SRV algorithm does this because "Domain administrators SHOULD use Weight 0 when there isn't any server selection to do, to make the RR easier to read for humans (less noisy)." Given our non-0 default, sites have to go out of their way to select weight 0, so it doesn't seem to make much sense to me. I think it's just simpler to not allow 0 weight endpoints to be selected in the presence of non-0 weight endpoints. |
I think the SRV algorithm makes more sense if you use a floating point RNG rather than an integer RNG. But there's no mention of which one you're supposed to use. |
At this point perhaps it makes more sense to remove references to SRV from the spec and spell out the algorithm directly in the Reporting spec instead. |
My understanding with the example weights of A: 1 and B: 2, if the arrangement of endpoints is randomly chosen the effective probabilities are:
which is close, but not quite the expected |
I'll remove the reference to SRV from the spec; given the subtle differences it's not correct to say that the fields have the same meaning, or that the algorithm is the same. |
An endpoint's
weight
is a non-negative integer, i.e. it is allowed to be 0. If all the endpoints with the minimumpriority
value have weight 0, then in step 9 of the Choose an endpoint from group algorithm, it will be impossible to choose a random weight value that is >= 0 and also < total_weight (i.e. 0).Also, the algorithm as written does not give endpoints with weight 0 any chance of being selected. This differs from the cited algorithm in RFC 2782, which does give endpoints with weight 0 a (small) chance of being selected.
(Credit to Eric Orth for pointing this out.)
The text was updated successfully, but these errors were encountered: