Investigate if CounterMetric can do increment using fetchAndAddRelaxed for better performance

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Service Arch
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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:
              [DO NOT USE] Backlog - Service Architecture
              Reporter:
              Wenbin Zhu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: