Skip to content

perf: Replace futures-locks with DashMap registry and bounded channels#1080

Open
gruberb wants to merge 5 commits intomasterfrom
perf/dashmap-bounded-channels
Open

perf: Replace futures-locks with DashMap registry and bounded channels#1080
gruberb wants to merge 5 commits intomasterfrom
perf/dashmap-bounded-channels

Conversation

@gruberb
Copy link
Member

@gruberb gruberb commented Feb 26, 2026

  • Replace futures-locks::RwLock<HashMap> with DashMap for the ClientRegistry, eliminating async lock contention on every connect/disconnect/notify
  • Switch from mpsc::unbounded to bounded channels with configurable client_channel_capacity (default 50) to apply backpressure and cap per-client memory
  • All registry methods become synchronous, removing .await from callers

- Replace `futures-locks::RwLock<HashMap>` with `DashMap` for the
  `ClientRegistry`, eliminating async lock contention on every
  connect/disconnect/notify
- Switch from `mpsc::unbounded` to bounded channels with configurable
  `client_channel_capacity` (default 50) to apply backpressure and
  cap per-client memory
- All registry methods become synchronous, removing `.await` from callers
@gruberb gruberb requested review from jrconlin and pjenvey February 26, 2026 11:34
@jrconlin
Copy link
Member

By the way, I'm not convinced that this actually saves memory or is substantially faster.
We had a vec of 10 notifications (max) DashMap builds a hashed lookup table which will probably consume at least the same memory as 1 notification. Still, I'm willing to give it a try to see if there is an improvement.

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.

2 participants