SERVER-69435 made obtaining the CollectionShardingState more costly, as it now needs to lock a mutex. This introduced a performance regression on some write paths – particularly the insert path. This is because getDocumentKey is called for every document in the batch, and every time getDocumentKey will obtain the CollectionShardingState.
It is unnecessary to get the CSS for every document in the batch. Instead, it can be obtained only once for the operation and use it for every document in the batch.
- related to
-
SERVER-77473 remove unused OperationContext parameter from repl::getDocumentKey()
-
- Closed
-