DPL: give each stream its own slot in the service registry - #15680
Open
ktf wants to merge 1 commit into
Open
Conversation
The registry derives a service's slot from the low 8 bits of type.hash ^ valueFromSalt(salt), but valueFromSalt puts streamId at bit 16, so streamId contributes nothing to it: every stream lands on the same slot for a given service, they pile into one MAX_DISTANCE-deep probe window, and the first which does not fit is refused -- with the error naming whichever service lost the race rather than the one which filled the window. Mix the salt into the low bits instead: only the starting slot changes, since valueFromSalt still carries key equality and both getPos and registerService go through instanceFromTypeSalt, and unlike widening the table this raises no new ceiling, the mask staying below bit 16 until MAX_SERVICES passes 65536. The added test registers one instance of the same stream service for each of 32 streams and asks for each of them back; on the old slot calculation it gets seven in before registration is refused.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The registry derives a service's slot from the low 8 bits of
type.hash ^ valueFromSalt(salt), but valueFromSalt puts streamId at bit 16, so
streamId contributes nothing to it: every stream lands on the same slot for a
given service, they pile into one MAX_DISTANCE-deep probe window, and the first
which does not fit is refused -- with the error naming whichever service lost
the race rather than the one which filled the window. Mix the salt into the low
bits instead: only the starting slot changes, since valueFromSalt still carries
key equality and both getPos and registerService go through
instanceFromTypeSalt, and unlike widening the table this raises no new ceiling,
the mask staying below bit 16 until MAX_SERVICES passes 65536. The added test
registers one instance of the same stream service for each of 32 streams and
asks for each of them back; on the old slot calculation it gets seven in before
registration is refused.