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

Make LRU cache utility more generic so that it can limit its size by bytes

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • QO 2021-09-20

      The base PlanCache implementation uses the LRUKeyValue store for caching plans. This class implements a least recently used (LRU) eviction policy based on the number of entries in the cache, which is set upon construction. This is fine for the classic PlanCache but in SBE the eviction policy should be based on memory consumption rather than on a number of entries. That is, we should be able to track a total amount of memory occupied by the plan cache entries and start eviction when it reaches a pre-defined limit set via a server configuration parameter.

      Given that we're looking to reuse this LRU store both for the classic and SBE engines, we need to abstract out the logic dealing with the cache size into a separate interface with two implementations - one would compute the size based on the number of cache entries, another one based on the total size of the entries - and refactor LRUKeyValue to support this new interface.

            Assignee:
            alexander.ignatyev@mongodb.com Alexander Ignatyev
            Reporter:
            anton.korshunov@mongodb.com Anton Korshunov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: