garbagedestroyer
All projects
Python

go-map-vs-redis-latency

Go sync.Map vs Redis latency comparison — when does an in-process cache beat a network round trip?

goredislatencybenchmarkcaching

Overview

Measures the crossover point where an in-process Go sync.Map becomes faster than a local Redis instance. Tests variable payload sizes and concurrency levels to identify the latency tradeoff.

Methodology

  • Local Redis: Same host, Unix socket
  • Go sync.Map: In-process with RWMutex
  • Payloads: 64B, 1KB, 64KB
  • Concurrency: 1–1K goroutines

Key Finding

For payloads under 1KB, sync.Map wins up to ~100 goroutines. Beyond that, Redis offers better tail latency due to connection pooling. The crossover moves with payload size.