sync.RWMutex protects shared data when reads greatly outnumber writes. Multiple goroutines can hold the read lock together, while a write lock excludes both readers and writers. section 4.2.1
Use the lock according to the critical section:
- Call RLock and RUnlock while traversing or copying shared data, preventing concurrent changes without blocking other readers. section 4.2.1
Read-heavy match monitor
A match recorder uses Lock while appending events, while thousands of client handlers use RLock while copying them. Concurrent readers can proceed together, improving the read-heavy server's performance compared with one exclusive mutex.



