Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-2321

Document eviction policy for ForestDB index

    XMLWordPrintable

Details

    Description

      Request
      Provide more details regarding the algorithm for ejecting Standard (ForestDB) indexes when they cannot fit in RAM.

      Background
      MOI behavior under OOM is already described here:
      https://developer.couchbase.com/documentation/server/4.6/indexes/gsi-for-n1ql.html
      We need similar type of information for FDB.

      As per engineering:

      Ejection algorithm of FDB buffer cache is simple. FDB tries to cache as many data as possible in its own in-memory cache, whose size is fixed and configured by upper level module (GSI in this case). If the overall data size is bigger than the cache size, FDB cache begins to eject blocks based on LRU algorithm.

      In addition to that, FDB cache classifies cached data into two types: index blocks and document blocks. Index blocks represent B+tree nodes that point to other blocks, while document blocks denote leaf nodes that contain actual key-value data. Index blocks have higher priority than that of document blocks, to minimize the number of disk IO per tree traversal. Generally the hit ratio of index blocks are greater than that of document blocks, granting priority to index blocks helps improving the overall hit ratio of the cache.

      FDB cache gives index blocks a second chance; when an index block is selected as a victim for ejection, FDB cache moves it to the front of LRU list instead of ejecting it. By contrast, document blocks are ejected immediately. If an index block becomes victim for ejection once again without further access since its second chance, FDB cache ejects it eventually.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              simon.dew Simon Dew
              alla.tumarkin Alla Tumarkin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty