Operational Defect Database

BugZero found this defect 30 days ago.

MongoDB | 2648354

Performance: Stats collection unitSize() does tcmalloc and free

Last update date:

4/19/2024

Affected products:

MongoDB Server

Affected releases:

6.3.2

4.4.29

6.0.15

7.0.8

7.3.0

8.1.0-rc0

8.0.0-rc2

Fixed releases:

No fixed releases provided.

Description:

Info

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. This ticket is to refactor this call, and perhaps other related ones, to look the value up once before entering the loop getting a batch of documents instead of inside the loop, reducing its frequency to only once per batch instead of once per document (two orders of magnitude reduction for full batches). This also requires a change in the low-level function to pass the size in from the caller instead of looking it up directly.

Top User Comments


Steps to Reproduce


Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

In Progress

Learn More

Search:

...