Hi everyone,
I’m working on hel-rs, a concurrency crate that grew out of constant frustration: in one place I needed a synchronous channel, in another an asynchronous one, in yet another a key based ordering across shards, and a worker pool that doesn’t lose messages when a handler panics. Each of these tasks was solved by a separate crate with its own guarantees, and it was precisely at the interfaces between modules that workarounds and bugs constantly cropped up. I wanted to try putting it all together in one place.
What it can do:
- A limited ring without MPMC/SPSC locks (Vyukov’s ring), where the same channel serves both blocking and asynchronous consumers (sync and async on the same queue)
- Sharding with three routing strategies: round_robin, shard_key (by hash), and shard_group (by explicit map) to maintain key order
- Safe asynchronous sending even on cancellation
- An elastic worker pool with a lossless guarantee: if a handler panics, the item goes to the dead letter queue exactly once; nothing is lost or duplicated. Plus, load balanced distribution: a hot shard gets its own worker instead of waiting in line behind others
Since this involves unsafe and atomic operations, try to cover:
- Loom tests
- Miri for unsafe
This is a personal project and it’s still in its early stages, so I’d genuinely appreciate any feedback.
Links:
Repository: https://github.com/vladbpython/hel
crates.io: hel-rs
Article (motivation and how I did it): medium