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

Reusing freed extents takes a long time

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Performance, Storage
    • None

      When we repeatedly create and drop large collections, the extent freelist gets very long and the server starts to take a long time to find a suitable freed extent to reuse while the database being write-locked. It can take from 10 sec to several minutes depending on the length of freelist. This is related to SERVER-3022 if I understand it correctly.

      warning: newExtent 16365 scanned
      warning: slow scan in allocFromFreeList (in write lock)

      There would be three approaches to mitigate this problem:

      1. Let users specify the size of initial extent both for collection data and indices to possibly reduce the number of extents to be allocated. This used to be partially achieved by passing size parameter on db.createCollection but it's no longer possible since 2.6.0 (see SERVER-13144). If a collection is supposed to grow to a large size (say 100 MiB), it makes no sense to start from the minimum extent, namely 4096 bytes long.
      2. Merge two freed extents if they are adjacent to each other. This could reduce the length of freelist.
      3. Have a cache of extent freelist on heap for faster searching. It's so slow to do random access on mmapped pages due to repeated page faults and disk seek/reads.

            Assignee:
            dan@mongodb.com Daniel Pasette (Inactive)
            Reporter:
            pho PHO
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: