Skip to content

Nexus v1.0.0: Breaking the Channel Bottleneck — Lock-Free Concurrency for High-Scale Go

Latest

Choose a tag to compare

@GenshIv GenshIv released this 05 Jul 16:02

This is the initial release of the Nexus library. Nexus provides lock-free concurrency primitives designed specifically for systems where the standard Go runtime channels and mutexes become the primary performance bottleneck.

Key Features
spsc (Single-Producer-Single-Consumer): A strictly lock-free queue that minimizes latency and cache contention. Benchmark results show ~10x improvement over standard channels in SPSC scenarios.

sharded (MPMC Mailbox): A decentralized, sharded MPMC (Multiple-Producer-Multiple-Consumer) message exchange. It leverages the Go scheduler for self-balancing load across multiple CPU cores, preventing "traffic jams" on the memory bus.

Mechanical Sympathy: Both primitives are designed with careful padding to prevent false sharing and are built using only atomic operations to avoid kernel context switches.

Zero-Allocation: The library is optimized to work with 0 B/op and 0 allocs/op, ensuring stability and preventing GC pressure under heavy load.

Performance Targets
Target Environments: Systems with 32+ cores (AMD EPYC, Intel Xeon Platinum).

Scalability: Unlike traditional ring buffers with global head/tail counters, the ShardedMailbox demonstrates linear scalability as the core count increases, showing up to 10.5x performance gains compared to standard Go channels on high-load scenarios.

Why Nexus?
Standard Go channels are highly versatile and excellent for general-purpose programming. However, in low-latency/high-throughput environments (HFT, game servers, databases), the synchronization overhead of channels is often too high. Nexus offers a direct "fast pipe" replacement for these specific, critical paths.

See the README for installation instructions, usage examples, and detailed benchmark logs.