[DocDB] Poor mutex behavior on TabletRetentionPolicy mutex
Jira Link: DB-23902
Description
Context: #34118 Related: #34359
On nodes with very high core count, it has been observed that a very large portion of CPU time is spent inside the __GI___lll_wait and __GI___lll_wake functions that underpin pthread mutexes.
Under high contention with short critical sections, pthread mutexes can perform poorly due to the lack of a designated waker. Blocked threads are woken up one by one faster than they can get scheduled and run, causing the mutex to effectively degrade into a spinlock. This shows up on flamegraphs as very large amounts of time spent in _raw_spin_lock.
One mutex where this is an issue is the TabletRetentionPolicy mutex, which gets locked on ScopedReadOperation creation and destruction. This dominates under high concurrency and core count in a single tablet workload.
Issue Type
kind/enhancement
Warning: Please confirm that this issue does not contain any sensitive information
- I confirm this issue does not contain any sensitive information.
Source: yugabyte/yugabyte-db