A blazing-fast KV store written in pure Golang without any dependencies with native pub-sub support, engineered for high-frequency, contention-heavy workloads.
Adaptive Sharding: a self-managing, self-healing system
✨ The system starts from a single bucket and scales dynamically in real-time! When keys expire, they immediately stop being served and are removed during the next resizing.
Peak Throughput: 115,809 ops/sec with 100 concurrent clients on an M2 MacBook Air.
nubmq vs. The Rest
Feature
nubmq
Redis
Memcached
Etcd
Architecture
Adaptive Sharding
Single-threaded
Static Buckets
Raft Consensus
Scalability
Auto-Scales Up/Down
Vertical Scaling
Horizontal Only
Limited
Write Latency
900µs
~1.1ms
~1.5ms
~3ms
Read Latency
500µs
~700µs
~1ms
~2ms
Max Throughput
178,766 ops/sec
~85,000 ops/sec
~60,000 ops/sec
~20,000 ops/sec
Pub/Sub Support
Yes, Instantaneous
Yes, Slow
No
No
TTL Handling
Native, Optimized
Yes, but Heavy
No
No
Lock-Free Reads
Yes
No
Yes
No
Memory Efficiency
High, Dynamic GC
Medium
High
Low
Dependencies
None (Pure Go)
Libevent, Lua
Libevent
Raft
Figures from testing on M2 Air or from official sources
Benchmarks
I recently replaced sync.map for buckets to a custom hashtable implementation and got a ~40 percent performance gain!
Benchmarked on a 8 core fanless M2 air (all cores maxed out under load)
Concurrent Clients: 100
Peak Throughput: 178,766 ops/sec
Average Throughput: 133,333.33 ops/sec
Dataset Size: 1,000,000 unique keys
Total Operations: 20,000,000 requests
Total Time Tracked: 150 seconds
Would love it if someone can test on a better machine and post the results
How to run
first start the server with:
bash
make build
run the benchmark with:
bash
make test
or start the client with:
bash
cd ./client
go run main.go
now just play around with commands like you do in redis-cli
WIP (Work in Progress)
Parallelized Shard Store resizing: would make shard store resizing faster
Clustering: currently only supports single nodes
nubmq is still a work in progress and is in no way perfect,there are still some data races here and there and a few unhandled errors feel free to report bugs and contributions in forms of issues and PRs are welcome