Shard your locks: benchmarking 6 Go cache designs
Summary
This article benchmarks six Go cache designs (naive map, mutex, rwmutex, sync.Map, sharded, and copy-on-write) across 1–8 cores and various workloads. It finds that lock striping with 256 shards offers the best overall performance, while RWMutex can hinder writes; copy-on-write shines for reads but is expensive on writes.