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

Freelist algorithm causes storage fragmentation


    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
    • Case:


      The algorithm used for the freelist groups related sizes into "buckets" that are searched for a free entry. The algorithm stops at 30 entries and then goes to the next bucket. If all buckets are searched then a new extent is allocated. In a high insert / delete environment where the inserts occur throughout the delay and peak and then deletes peak at a separate time (for example a session cache for a web site) this algorithm results in very large freelists where the smallest items filter to the top of each bucket. The freelist becomes filled with items that are never reused and blocking items that can be reused. One option is to allocate only on the bucket size (256, 512, 1024, etc.) which would guarantee that all items in the freelist are reusable. The following pull request https://github.com/mongodb/mongo/pull/37 illustrates how this could be fixed.


          Issue Links



              • Votes:
                19 Vote for this issue
                27 Start watching this issue


                • Created: