[SERVER-75529] Revisit memory layout for TenantId, DatabaseName, and NamespaceString to address performance regression Created: 31/Mar/23  Updated: 29/Oct/23  Resolved: 26/Apr/23

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.0-rc1

Type: Improvement Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Matt Broadstone
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Problem/Incident
Related
related to SERVER-77228 Improve memory layout of NamespaceStr... Closed
is related to SERVER-74849 CommandInvocation: Don't re-parse Nam... Closed
is related to SERVER-75117 Avoid NamespaceString copies when pos... Closed
is related to SERVER-74848 Addess recent performance regressions... Closed
is related to SERVER-64608 Add tenantID to NamespaceString Closed
is related to SERVER-66963 Improve performance of NamespaceStrin... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v7.0
Sprint: Server Serverless 2023-04-17, Server Serverless 2023-05-01
Participants:
Linked BF Score: 129

 Description   

NamespaceString is one of the core datatypes of the system. It is widely used for authorization checks, logging, resource locking, etc. Ongoing changes have led to the NamespaceString class to grow from 40 bytes to 88 bytes and based on this patch build it appears the performance is sensitive to changes only to the size of the data structure (e.g. 8-9% throughput drop for linkbench2).

The addition of the DatabaseName class as a member variable to NamespaceString is what accounts for the additional 48 bytes. We should explore different memory layouts for TenantId, DatabaseName, and NamespaceString to have the system be more efficient.



 Comments   
Comment by Githook User [ 02/May/23 ]

Author:

{'name': 'Matt Broadstone', 'email': 'mbroadst@mongodb.com', 'username': 'mbroadst'}

Message: SERVER-75733 SERVER-76222 SERVER-75529 SERVER-76632 SERVER-76632 Backport perf improvements to NamespaceString

(cherry picked from commit 3e76161bc537343aa585b305c068b1910578c07f)
(cherry picked from commit 7cc71f7d5f29a5850a4d186b9554df3dcb407117)
(cherry picked from commit 7c1ed6898f9004cf7aa9b2e16371fa83c72b3ba3)
(cherry picked from commit 95782eb4c729cd341ae2398863faa8292d8abd4e)
(cherry picked from commit bcff3cee04973b3ab91b78a70ca6b5740f22e1a0)
Branch: v7.0
https://github.com/mongodb/mongo/commit/57cb7734d42bad79f636e9be2ad313398614e83e

Comment by Githook User [ 26/Apr/23 ]

Author:

{'name': 'Matt Broadstone', 'email': 'mbroadst@mongodb.com', 'username': 'mbroadst'}

Message: SERVER-75529 Reduce the width of NamespaceString
Branch: master
https://github.com/mongodb/mongo/commit/7c1ed6898f9004cf7aa9b2e16371fa83c72b3ba3

Comment by Louis Williams [ 31/Mar/23 ]

If it helps, we had similar issues when we increased the size of RecordId. One of the main improvements involved removing any unnecessary copies SERVER-67471 and re-packing the struct more efficiently.

Generated at Thu Feb 08 06:30:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.