An innocuous looking stats collection call from SERVER-51024 causes significant performance regression in microbenchmark Queries.FindProjectionThreeFields. The call is made for every document seen in run_aggregate.cpp getFirstBatch(). The issue is that the innocent-looking unitSize() call in observeOne() in resource_consumption_metrics.h has become very expensive since it was changed to return gDocumentUnitSizeBytes, which is an IDL-based server parameter and uses intrusive pointers, thus triggering a tcmalloc and free every time it is accessed.
Changing gDocumentUnitSizeBytes to the constant 128, its default, in unitSize() results in a +20% performance gain in this benchmark.
geert.bosch@mongodb.com advised that the stats parameters
- gDocumentUnitSizeBytes
- gIndexEntryUnitSizeBytes
- gTotalUnitWriteSizeBytes
(defined in operation_resource_consumption.idl) no longer need to be tunable, so the fix is to remove these and replace them with their integer constant defaults. Additionally the computations involving these do not need to use floating point division.
- is related to
-
SERVER-91063 Revert SERVER-89643
- Closed
- related to
-
SERVER-89725 Peformance: Improve speed of IDL-based server parameter lookups
- Closed