Go Perf Contention And Sharding

Reduces Go lock contention by sharding state into N lock-striped shards keyed by hash; shard-count and padding guidance; sync.Map's two optimized use cases vs a sharded map[K]V+Mutex for the general case; per-P counters summed on read; batching to amortize a lock; singleflight to collapse duplicate work. Fires on "reduce lock contention", "shard this map", "sync.Map vs mutex map", "hot mutex", "lock striping". Routes sync.Map API to go-sync-primitives, padding to go-perf-false-sharing, measuring to go-perf-block-mutex-profiles.

ctoth 4a8892a 3 files · 26.4 KB Updated

File contents

ctoth/golang-skills-plugin/tree/main/plugins/performant-golang/skills/go-perf-contention-and-sharding commit 4a8892a19e

Frequently asked questions

npx skillmds@latest add ctoth/go-perf-contention-and-sharding