Skip to content
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

Add NonConsistentHashPoolProvider #49

Merged
merged 1 commit into from
Mar 5, 2024
Merged

Add NonConsistentHashPoolProvider #49

merged 1 commit into from
Mar 5, 2024

Conversation

bisho
Copy link
Member

@bisho bisho commented Nov 6, 2023

A NonConsistent hash is more heavy in CPU than a simple crc32 and it can also be less balanced. Since we have plenty of options to manage out pools, we usually grow a pool by migrating into a new one, not expanding a present one, having a simple non-consistent is a good option.

INITIAL.multithreaded: Overall: 110779.55 RPS / 9.03 us/req
INITIAL.singlethreaded:Overall: 111545.63 RPS / 8.96 us/req
NON_CONSISTENT_SHARDING.multithreaded:Overall: 124463.31 RPS / 8.03 us/req
NON_CONSISTENT_SHARDING.singlethreaded:Overall: 126979.22 RPS / 7.88 us/req

Before:
Screenshot 2023-11-06 at 12 15 25

After:
Screenshot 2023-11-06 at 12 16 55

@bisho bisho requested a review from a team November 6, 2023 11:34
@bisho bisho marked this pull request as ready for review November 6, 2023 11:34
@bisho bisho force-pushed the add_non_consistent_hash branch from ec883ec to e5acdfe Compare November 6, 2023 13:30
Copy link

@thecadams thecadams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Any other hashing algorithms considered, or ok with crc32 for now? Lots of others on https://github.com/rurban/smhasher including issues with each

@bisho
Copy link
Member Author

bisho commented Nov 7, 2023

Nice! Any other hashing algorithms considered, or ok with crc32 for now? Lots of others on https://github.com/rurban/smhasher including issues with each

I tried a few (like meow hash, liked the name punch) but most are rust and the bridging kills the performance wins. But we can definitely try and add others.

Note collisions are not significant as we are using this for sharding, we will "collision" all keys over a few servers anyway, so the characteristics of the hash are not as important as the evenness of the output :)

Also note we are not (yet) changing to use a different sharding, this just offers the choice and makes an example on how to add other sharding algs.

@bisho bisho force-pushed the add_non_consistent_hash branch from e5acdfe to cede4b3 Compare March 5, 2024 13:31
@bisho bisho force-pushed the add_non_consistent_hash branch from cede4b3 to d3da834 Compare March 5, 2024 14:09
@bisho bisho changed the base branch from add_benchmark to main March 5, 2024 14:11
@bisho bisho force-pushed the add_non_consistent_hash branch from d3da834 to bc86e86 Compare March 5, 2024 14:12
@bisho bisho merged commit fea2251 into main Mar 5, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants