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

Introduce a relaxed memory order for our Counter64 API

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Service Arch
    • Fully Compatible
    • Service Arch 2024-03-18, Service Arch 2024-04-01

      We record a lot of metrics in serverStatus that are of type CounterMetric. The increment() function of CounterMetric uses atomic fetch_add() which by default uses memory order std::memory_order_seq_cst that is expensive since it needs to synchronize cpu cores with memory fences. Since they are for metrics, it seems we can use fetchAndAddRelaxed instead which uses a relaxed memory ordering, to reduce the synchronization overheads.

            Assignee:
            mathis.bessa@mongodb.com Mathis Bessa (Inactive)
            Reporter:
            wenbin.zhu@mongodb.com Wenbin Zhu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: