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 KeyedMutex #4065

Open
wants to merge 11 commits into
base: series/3.x
Choose a base branch
from
Open

Conversation

BalmungSan
Copy link
Contributor

@BalmungSan BalmungSan commented Apr 24, 2024

Extention to the current Mutex class to support one look per key.

I extracted the LockQueue and lock implementations into their own file to allow reuse.

I added a basic suite of tests, mostly focused on multiple key interactions.
Since each key is, in essence, its own Mutex I don't think we need to replicate all the complex Mutex tests... since those are actually tests for the LockQueue.

@BalmungSan BalmungSan marked this pull request as draft April 24, 2024 17:49
@SystemFw SystemFw assigned SystemFw and unassigned SystemFw Apr 26, 2024
@iRevive
Copy link
Contributor

iRevive commented Oct 6, 2024

Should we use a MapRef instead of a Ref[Map]? Could that help reduce contention?

I have observed lower memory footprint while using MapRef instead of Ref[F, Map[K, V]] in some cases.

@armanbilge
Copy link
Member

I have observed lower memory footprint while using MapRef instead of Ref[F, Map[K, V]] in some cases.

@iRevive One of the implementations of MapRef is literally a Ref[Map], maybe your observations are related to a ConcurrentHashMap-backed MapRef ?

@iRevive
Copy link
Contributor

iRevive commented Oct 6, 2024

I have observed lower memory footprint while using MapRef instead of Ref[F, Map[K, V]] in some cases.

@iRevive One of the implementations of MapRef is literally a Ref[Map], maybe your observations are related to a ConcurrentHashMap-backed MapRef ?

Yes, it was the MapRaf that uses ConcurrentHashMap under the hood.

@BalmungSan BalmungSan force-pushed the add-keyed-mutex branch 2 times, most recently from f351aec to b983469 Compare November 23, 2024 19:49
@BalmungSan BalmungSan marked this pull request as ready for review November 23, 2024 19:49
@armanbilge armanbilge changed the title WIP: Add KeyedMutex Add KeyedMutex Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants