Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-77012

Optimize NamespaceString construction in authorization path

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0, 7.0.0-rc1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • v7.0
    • Server Serverless 2023-05-15, Server Serverless 2023-05-29

      When inspecting a recent flamegraph, we observed a decent amount of time spent in authorization and in particular in NamespaceStringUtil for parsing tenant ids for requests. A few optimizations came to mind:

      • Don't combine dbName and collectionName into a string, just to split it later when building a NamespaceString.
      • Alternatively, skip parsing completely in all paths if multitenancy is not enabled
      • Provide optimized constructors for both NamespaceString(DatabaseName, StringData) and NamespaceString(boost::optional<TenantId>, StringData, StringData) to avoid any unnecessary allocations

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            matt.broadstone@mongodb.com Matt Broadstone
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: