~/talk

Tackling Contention : The Monster in sync.Locker

Talkat GopherCon Europe 2019 · 2019-05-30..06-01· [concurrency, go]
slides:none on file

Measures show mutex wait time dominating CPU profiles: pprof reports tiny flat time but large cumulative time spent acquiring locks when many goroutines increment a shared counter. Live trace captures in production (minutes at a time) reveal tail latency and scheduler delays. Cache experiments show 64-bit writes beat 8-bit due to cache-line invalidation, so false sharing is real. Remedies: split state into buckets carefully, pad structs or use sync.Map or an atomic CAS loop for read-mostly values, but atomics break the race detector and cost complexity.

AI-written summary · about

  1. 0:00Introduction
  2. 0:46What is contention
  3. 1:38Tools
  4. 2:44Example
  5. 3:45Output
  6. 4:20Supersize
  7. 5:10Trace
  8. 5:36Regions
  9. 6:55Routines
  10. 7:14Trace view
  11. 7:56Measuring too much
  12. 8:12Dont measure too much
  13. 8:28Maybe before
  14. 9:08Hardware
  15. 9:39Stop sharing
  16. 10:06Content less
  17. 10:26Mutex
  18. 11:03Rainbows
  19. 12:13Synchronization
  20. 12:46Read Mutex
  21. 13:18SyncMap
  22. 14:08Raw
  23. 15:05Clock
  24. 16:20Performance
  25. 17:05Padding
  26. 18:20Unsafe
  27. 21:47Questions
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.