Tackling Contention: The Monsters Inside the 'sync.Locker'
summary
Shows how pprof and the mutex profile expose that a simple increment loop spends >95% of time waiting on sync.Locker, and how trace regions pin down tail latency and scheduler wait time. Demonstrates splitting state into N shards and batching updates to cut contention by the number of shards, explores tradeoffs of replacing channels with mutexes, when sync.Map helps, and the pitfalls and hazards of switching to atomics, with real crash-causing examples.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:05Tools
- 7:31Measure
- 8:06Algorithm
- 9:06Channels
- 13:16Code
- 15:25Memory
- 18:18Map
- 21:22Shared Integral
- 23:29History
related talks
25mTackling Contention : The Monster in sync.Locker
04mThe monsters inside the sync.Locker
01h 06mLocks are tricky — let's understand them by building one
39mLet's talk concurrency
01h 02mMaking Games Start Fast: A Story About Concurrency
53mAtomics, Locks, and Tasks (part 1 of 2)
50mThe Hidden Art of Thread-Safe Programming: Exploring java.util.con...
01h 07mThe C++20 Synchronization Library
