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

Speedup logic to persist routing table cache

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.1, 7.2.0-rc0, 7.0.4, 6.0.13, 5.0.25
    • Affects Version/s: 7.0.1, 4.4.24, 6.0.10, 5.0.21, 7.1.0-rc2
    • Component/s: None
    • Labels:
    • Sharding EMEA
    • Fully Compatible
    • v7.1, v7.0, v6.0, v5.0, v4.4
    • Sharding EMEA 2023-10-02
    • 35

      Each shard maintain a persisted version of the collection routing table cache in config.cache.chunks.<nss>. The function used to update this collection is updateShardChunks that is performing sequentially a delete operation followed by an insert operation for every new chunk.

      When the number of new chunks to persist is high, this logic could become extremely slow. For instance, with a routing table of 10 millions chunks, it could take up to 45 min to persist the entire routing table.

      This is problematic because until all the updated chunks get persisted, they will slow down considerably all the concurrent incremental routing table refreshes. For instance, an incremental refresh for a routing table of 10 millions chunks usually takes on the order of 10 milliseconds, but if the routing table needs still to be persisted to disk this incremental refresh can take up to ~5 secs.

      The goal of this ticket is to speedup the logic that persist new chunks in config.cache.chunks.<nss>. One potential solution could be to perform a batch of deletions followed by a batch of insertion.

            tommaso.tocci@mongodb.com Tommaso Tocci
            tommaso.tocci@mongodb.com Tommaso Tocci
            0 Vote for this issue
            6 Start watching this issue