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

Introduce a database-scoped dual catalog cache to avoid doubling memory footprint for collection metadata

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • CAR Team 2025-04-28, CAR Team 2025-05-12
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      The dual catalog cache workstream was a necessary technical step to enable the transition to authoritative shards. Although this step is required, it doubles the memory footprint of the CatalogCache in the running MongoD process.

      The original plan was to introduce the dual catalog cache as a binary change, and then, during the FCV upgrade, shift to relying on authoritative shards. This would eliminate the need to use the CatalogCache for filtering metadata, thereby reducing its memory footprint back to its original size.

      The problem arises if we want to make SPM-3729 production-ready without delivering collection-level authoritative shards. In that case, we still need the dual catalog cache, but it would result in an increased memory footprint for collection metadata throughout the entire 9.0 FCV lifecycle.

      Proposed workaround:

      • Database metadata: introduce a new feature flag gDatabaseDualCatalogCache
        • This flag will enable a second catalog cache instance, used exclusively for database metadata filtering usages.
        • When enabled, it will configure the Grid::CatalogCache to use the ConfigServerCatalogCacheLoader for database metadata routing usages, fully bypassing SSCCL for this path.
      • Collection metadata: no change of behavior from 8.0
        • Continue to rely on the existing Grid::CatalogCache and ShardServerCatalogCacheLoader for collection metadata routing and filtering usages, for now.

      Future step:
      Enable the existing gDualCatalogCache flag once shards are ready to become authoritative for collection metadata. This will make collection metadata filtering usages rely on the ShardServerCatalogCacheLoader and routing usages on the ConfigServerCatalogCacheLoader.

        1. dual_catalog_cache-5.png
          dual_catalog_cache-5.png
          420 kB
        2. dual_catalog_cache-4.png
          dual_catalog_cache-4.png
          427 kB
        3. dual_catalog_cache-3.png
          dual_catalog_cache-3.png
          421 kB
        4. dual_catalog_cache-2.png
          dual_catalog_cache-2.png
          425 kB
        5. dual_catalog_cache-1.png
          dual_catalog_cache-1.png
          366 kB

            Assignee:
            pol.pinol@mongodb.com Pol Pinol
            Reporter:
            pol.pinol@mongodb.com Pol Pinol
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: