Change classic plan cache to adhere to a configurable memory limit

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The goal of this ticket is to change MongoDB's classic plan cache so that it is guaranteed to use no more than a user-configurable amount of memory.

      In the field, we have have seen several reports of certain workloads resulting in enormous in-memory plan caches. This can render the mongod unusable until it's either restarted or until the large plan caches are cleared, and it can be difficult to diagnose.

      There are a couple issues that need to be solved:

      • At present we have a separate plan cache for each collection, so it's difficult to quickly determine how much memory is collectively being used by all the plan caches in the mongod process. (SERVER-40360)
      • Each plan cache currently has a limit based on "# of plan cache entries", rather than having a limit based on memory consumption. It's unclear if we have the appropriate code exists to estimate how much memory is being consumed by each plan cache entry. (SERVER-34886)

      Also, if we have spare time, it would be good to see if there are any further improvements we can do to reduce how much memory is used by each plan cache entry (for example, SERVER-48057 proposes using compression for parts of the plan cache entry that aren't accessed frequently).

            Assignee:
            Unassigned
            Reporter:
            Drew Paroski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: