VortexKV: Building an ultra-fast in-memory KV cache engine in pure Go (6.87M ops/sec, zero CGO)

Hey everyone! :waving_hand:

I’m excited to share VortexKV, an ultra-high performance in-memory key-value cache engine written in 100% pure Go (zero CGO dependencies).

For years, the consensus in high-throughput systems engineering has been that to achieve multi-million ops/sec with sub-millisecond latencies, you had to turn to C, C++, or Rust to avoid runtime garbage collection pauses. We built VortexKV to test the boundaries of pure Go.

:bar_chart: Benchmark Highlights (Local commodity hardware)

  • 6.87 Million ops/sec sustained pipelined throughput
  • <180μs p99 latency under heavy multi-client concurrent load
  • Zero GC spikes: 0 B/op allocations on hot read/write paths

:gear: How It Works Under the Hood

  1. Pinned Reactor Goroutines (runtime.LockOSThread): Dedicated network worker goroutines are locked to dedicated OS threads and CPU cores to eliminate OS scheduler thread migration and context switching latency.
  2. Cyclic Ring Buffers & Batched Coalescing: Each TCP client connection receives preallocated circular buffers. Socket write calls are coalesced into batches (up to 128 responses per syscall), cutting kernel transitions drastically.
  3. 256-Shard Lock Striping: Keys are hashed across 256 independent partitions with 64-byte cacheline padding to prevent false sharing across CPU cores.
  4. Custom Memory Arena Allocator: Memory allocations bypass the standard Go heap allocator on hot paths, starving the garbage collector and maintaining predictable low p99 latencies.
  5. Full Redis Protocol (RESP2) Compatibility: Drop-in compatible with standard Redis tools and clients (redis-cli, go-redis, ioredis, Jedis).
  6. Sub-millisecond AOF Persistence & Real-time Web Studio Dashboard: Embedded on port 7380 for real-time monitoring, visual latency histograms, and keyspace browsing.

:rocket: Quick Start

Docker (6.4 MB scratch container, 0 CVEs):

docker run -d -p 7379:7379 -p 7380:7380 ianshugarg/vortexkv:latest

Connect with standard redis-cli:

redis-cli -p 7379 PING
# PONG

I would love to get your feedback, architectural critiques, and benchmarking tips from the Go community!