Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kv: acquire Replica shared mutex in tryGetOrCreateReplica
This commit switches the common path in `tryGetOrCreateReplica` from grabbing the Replica mutex in an exclusive mode to grabbing it in a shared mode. The common path in `tryGetOrCreateReplica` does not mutate the Replica, so there's no need for the stronger lock. The locking in `setLastReplicaDescriptors` showed up in a mutex profile under a write-heavy workload. It was responsible for **2.06%** of mutex wait time. Grabbing the mutex was probably also slowing down Raft request processing, as the exclusive lock acquisition had to wait for other read locks to be dropped.
- Loading branch information