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

Cache the APIVersionMetrics::update

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Replication
    • Repl 2023-05-29, Repl 2023-06-12, Repl 2023-08-07, Repl 2023-08-21
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      APIVersionMetrics::update tracks the last used DateTime of a given <Application Name, API Version> pair. For every request, we take a global mutex, do a two level lookup through hash tables and then update a datetime.

      I surmise, that for a given client the pair of <Application Name, API Version> never changes after initial connection. For instance, with non-internal clients, Application Name can only be set on the first hello command. For internal clients (mongos -> mongod), Application Name can be changed but it is unlikely. The API Version likely also does not change during the lifetime of a connection.

      To avoid the two level lookup and global lock, we could cache a handle in mongo::Client to an atomicword for date_t and then reuse that it <Application Name, API Version> has not changed.

      I would expect a small perf benefit by avoiding the lock and lookups.

            Assignee:
            xuerui.fa@mongodb.com Xuerui Fa
            Reporter:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: