Make disaggBlockCacheSizeBytes runtime-settable to allow live resizing of the PALI block cache

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Engines - Persistence
    • Fully Compatible
    • SE Persistence backlog
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Issue Summary

      Today the PALI block cache size is fixed at startup: disaggBlockCacheSizeBytes is set_at: startup only. To support dynamic memory management (shrinking the cache under memory pressure and growing it back when headroom returns), the size must be adjustable at runtime. This ticket lands the server-side plumbing that makes live resizing possible. The policy that decides when and how much to resize is tracked separately in the mongotune ticket under this epic (see linked TUNE ticket).

      This is the part of the POC we want to keep. The in-process, RSS-based monitor thread from the POC and the disaggBlockCacheMemoryPressureThresholdPercent knob are intentionally not included here — that decision logic moves to mongotune.

      Context

      • Files: src/mongo/db/modules/atlas/src/disagg_storage/server_parameters.idl, server_parameters.cpp, {{pali/block_cache/pali_block_cache. {h,cpp}

        }}, pali/block_cache/sized_lru_cache.h.

      • disaggBlockCacheSizeBytes is currently set_at: startup with cpp_varname: gBlockCacheSizeBytes (plain long long).
      • SizedLRUCache only evicts inline inside insert(); there is no path to shrink the cache after construction.

      Proposed Solution

      • Change disaggBlockCacheSizeBytes to set_at: [startup, runtime], backed by a custom DisaggBlockCacheSizeServerParameter (override_set: true) whose setter resizes the live cache via getBlockCache(...)->setMaxSize(...).
      • Add BlockCache::setMaxSize(size_t) -> ConcurrentSizedLRUCache::setMaxSize (divides the new bound across shards) -> SizedLRUCache::setMaxSize.
      • Refactor the inline eviction loop in SizedLRUCache::insert() into a shared _evictToMaxSize() helper, and call it from setMaxSize() so the cache immediately evicts down to a newly-lowered bound.
      • Make gBlockCacheSizeBytes atomic. It becomes runtime-mutable and is read concurrently from the cache path; the POC left it as a plain long long, which is a data race once the parameter is runtime-settable.

      Definition of Done

      • {{db.adminCommand( {setParameter: 1, disaggBlockCacheSizeBytes: <N>}

        )}} resizes the live cache, evicting immediately when shrinking.

      • Setting the parameter to 0 empties/disables the cache; restoring a positive value re-grows the ceiling.
      • getParameter reflects the current value.
      • Unit tests cover runtime set (grow, shrink, set-to-zero) and concurrent reads with no race (TSAN clean).
      • No behavior change at startup for existing configurations.

            Assignee:
            Etienne Petrel
            Reporter:
            Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: