Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24990: storage: avoid acquiring raftMu in Replica.propose r=nvanbenschoten a=nvanbenschoten Related to #9827. This addresses a TODO to avoid acquiring `Replica.raftMu` in `Replica.propose` in the common case where the replica's internal raft group is not null. This showed up in blocking profiles when running sysbench's `oltp_insert` workload. Specifically, the locking of `raftMu` in `Replica.propose` was responsible for **29.3%** of blocking in the profile:  _raftMu locking in Replica.propose is responsible for the second large pillar_ This change increases throughput of the sysbench workload by **11%** and reduces the reported average latency by **10%**. This was averaged over a few runs. Below is the output of a representative run before and after. Before ``` SQL statistics: queries performed: read: 0 write: 202253 other: 0 total: 202253 transactions: 202253 (3368.51 per sec.) queries: 202253 (3368.51 per sec.) ignored errors: 0 (0.00 per sec.) reconnects: 0 (0.00 per sec.) Throughput: events/s (eps): 3368.5102 time elapsed: 60.0423s total number of events: 202253 Latency (ms): min: 0.99 avg: 37.98 max: 141.98 95th percentile: 58.92 sum: 7681469.72 Threads fairness: events (avg/stddev): 1580.1016/4.11 execution time (avg/stddev): 60.0115/0.01 ``` After ``` SQL statistics: queries performed: read: 0 write: 228630 other: 0 total: 228630 transactions: 228630 (3808.46 per sec.) queries: 228630 (3808.46 per sec.) ignored errors: 0 (0.00 per sec.) reconnects: 0 (0.00 per sec.) Throughput: events/s (eps): 3808.4610 time elapsed: 60.0321s total number of events: 228630 Latency (ms): min: 3.59 avg: 33.60 max: 156.34 95th percentile: 51.02 sum: 7680843.03 Threads fairness: events (avg/stddev): 1786.1719/3.89 execution time (avg/stddev): 60.0066/0.01 ``` After this change, the blocking profile shows that `Replica.propose` is no longer a problem:  Release note (performance improvement): Reduce lock contention in Replica write path. Co-authored-by: Nathan VanBenschoten <[email protected]>
- Loading branch information