-
Notifications
You must be signed in to change notification settings - Fork 171
Open
Description
We want to instrument our use of a large, single dashmap in our server process with some metrics like lock held time.
These metrics are only accurate if we can track which shard we operate on.
For now we're simply recording metrics for the entire dashmap and the shard count, which gives us the average per shard but nothing more.
The current raw-api
feature theoretically allows getting the shard, but it requires us to hash twice, once to get the shard and once inside dashmap, which is an unacceptable waste of work.
I can think of two possible solutions, both of which would require an API change (or a private fork):
- Make many more internals public with the
raw-api
feature (similar to what Consider makingRefMut::new
public when raw-api is enabled #248 asks for) and reimplementget
/get_mut
/entry_ref
in our codebase, giving us visibility of the shard index for free. - Adding variants of the main public methods that also return the shard index, e.g.
get_mut_with_shard_index(..) -> (Option<RefMut<...>>, usize
or something like that, probably behind a new feature flag
I would be willing to implement any of these, if they're welcome, but i'm aware that they're both not very elegant ideas
Metadata
Metadata
Assignees
Labels
No labels