Investigate/implement reduced contention in ObservableMutexRegistry::add

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor - P4
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Networking & Observability
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In SERVER-106630, we added an additional mutex to ObserableMutexRegistry in order to allow mutexes to be registered independently of collection.

      We can provide even better isolation by using a std::list as a queue between add() and _collectStats().

      Evaluate whether this is worth doing.

      Here's some pseudocode:

      mutex _registration;    
      mutex _collection;    
          
      std::list<NewEntry> _new;    
      some_map_thing<Entry> _entries;    
          
      add() {    
          list<NewEntry> newNode{...};    
          lock{_registration};    
          _new.splice(...);    
      }    
          
      collect() {                      
          list<NewEntries> newbies;
          {                           
              lock{_registration};     
              newbies.splice(_new);

               }
                                
          lock{_collection};              
          for each newbie in newbies {                            
              add an Entry to _entries corresponding to newbie
               }
                                           
          // now _entries is up to date                         
          // continue with "old" implementation of collect()
      }    

            Assignee:
            Unassigned
            Reporter:
            David Goffredo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: