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

ensure shard count == # keys #257

Open
amilkov3 opened this issue Mar 2, 2023 · 1 comment
Open

ensure shard count == # keys #257

amilkov3 opened this issue Mar 2, 2023 · 1 comment

Comments

@amilkov3
Copy link

amilkov3 commented Mar 2, 2023

much like a sharded db, i have keys that are totally independent of each other so it would be nice to have a way to just make sure that writes to a single key do not block reads or writes to any other key. as far as i understand currently the shard count is calculated based off # of cores. and writes to a key in one shard block all ops to the other keys in that shard?

is this or will this be possible?

@imagine-hussain
Copy link

Is this method sufficient?

https://docs.rs/dashmap/latest/dashmap/struct.DashMap.html#method.with_shard_amount

Given that #shards needs to be a power of 2 according to the docs, I'm doubtful that having exactly one shard per key is possible but, having shards == capacity may be.

Otherwise would a try_reshard be better for once you exceed capacity?

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

No branches or pull requests

2 participants