Nexus-slab v0.5.0 - Slab allocator for predictable tail latency (feedback wanted)
⚓ Rust 📅 2026-01-10 👤 surdeus 👁️ 3I've been working on nexus-slab, part of the Nexus project - a collection of non-general-purpose but high-performance primitives for high performance systems.
The problem: Standard Vec-backed slabs have bimodal p999 latency. When capacity is exceeded, Vec reallocates and copies all existing data. At scale, this copy dominates - you'll see p999 jump from ~30 cycles to 2400+ cycles depending on whether a realloc lands in your measurement window.
The tradeoff:
| Metric | nexus-slab | slab crate |
|---|---|---|
| p50 | 24 cycles | 22 cycles |
| p99 | 26-28 cycles | 24-42 cycles |
| p999 | 38-46 cycles | 32-3700 cycles (bimodal) |
| max | ~500-800K cycles | ~1.2-2M cycles |
You pay ~2 cycles on median to eliminate reallocation spikes.
How it works: Independent page-aligned slabs that grow without copying existing data. Two-level freelist (slab → slot) with LIFO reuse for cache locality.
This is probably NOT for you if:
- Your slab stays "small"
- Tail latency isn't a huge concern
- The
slabcrate works fine for your use case
This might be for you if:
- You're building order books, matching engines, session managers, or game servers
- You've profiled and see reallocation spikes in your p99/p999
- Predictable worst-case matters for your SLAs
- You have large slabs
Feedback wanted:
- Does the API surface make sense?
- Any workloads you'd want benchmarked?
- Missing features that would block adoption?
2 posts - 2 participants
🏷️ Rust_feed