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

Account for size of KVMap in LRUKeyValue cache memory budget tracking

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization

      With changes from SERVER-71882, the size of the BSON key and telemetryMetrics value are included in LRUKeyValue memory tracking. However, the size of KVMap, which holds a int_32 hash of the cache keys and pointers to the associated key's position in KVList, should also be included in memory tracking. 

       

      LRUKeyValue should maintain its own budge tracker for this overhead cost. It might make sense to replace the estimator from LRUBudgetTracker with a lambda:

      template <typename K, typename V>
      class LRUBudgetTracker {
      public:
      LRUBudgetTracker(size_t maxBudget) : _max(maxBudget), _current(0) {}
      void onAdd(const K& k, const V& v, std::function<size_t(const K&, const V&)> estimator)
      { _current += estimator(k, v); } 

      This would call the estimator defined in LRUKeyValue which would have a flag for including overhead size or not in total size. In case of classic plan cache, we only want to know number of entries. We do not care about the size of the keys, size of the plans, or size of overhead. However, we do care about size of overhead for SBE plan cache and telemetry.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            maddie.zechar@mongodb.com Maddie Zechar
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: