WiredTiger eviction thresholds

WiredTiger eviction thresholds

WiredTiger uses several threshold numbers to ensure smooth operation of its cache, and two different thread types to perform cache eviction operations:
  • worker threads are assigned to eviction work
  • application threads are spawned by MongoDB to handle client requests
How WiredTiger uses these two types of threads to evict cache content depends on whether the page is clean (unchanged) or dirty (modified). Evicting a dirty page requires more work, as WiredTiger must reconcile modifications on the page before evicting it from the cache.
WiredTiger attempts to keep cache usage under 80% of the configured size. When the cache hits this number, the worker threads start clearing space in the cache. When the cache hits 95%, application threads start contributing to cache eviction. This can cause performance issues outside of WiredTiger, as the threads that are responsible for servicing user queries are now helping to manage the cache instead.

Eviction threshold options

SettingDescription
eviction=(threads_min=X)The minimum number of WiredTiger eviction worker threads running. Must be a value between 1 and 20.
eviction=(threads_max=X)The maximum number of WiredTiger eviction worker threads running. Must be a value between 1 and 20. This should match the threads_min setting for MongoDB.
eviction_checkpoint_target=XPerform eviction at the beginning of checkpoints to bring the dirty content in cache to this level, expressed as a percentage of the total cache size. The goal is to limit the amount of potential IO a checkpoint needs to do.
eviction_dirty_target=XPerform eviction in worker threads when the cache contains at least this much dirty content, expressed as a percentage of the total cache size.
eviction_dirty_trigger=XTrigger application threads to perform eviction when the cache contains at least this much dirty content, expressed as a percentage of the total cache size.
eviction_target=XPerform eviction in worker threads when the cache contains at least this much content, expressed as a percentage of the total cache size.
eviction_trigger=XTrigger application threads to perform eviction when the cache contains at least this much content, expressed as a percentage of the total cache size.

Default values

MongoDB v3.2.13 and v3.4.3

SettingDefaultRelated server changes
eviction=(threads_min=X)4SERVER-28026
eviction=(threads_max=X)4
eviction_checkpoint_target=X15
eviction_dirty_target=X5
eviction_dirty_trigger=X20
eviction_target=X80
eviction_trigger=X95

MongoDB v3.2.10

SettingDefaultRelated server changes
eviction=(threads_min=X)1
eviction=(threads_max=X)4
eviction_checkpoint_target=X15WT-2903
eviction_dirty_target=X5WT-2764
eviction_dirty_trigger=X20WT-2764
eviction_target=X80
eviction_trigger=X95

Prior to MongoDB v3.2.10

SettingDefaultRelated server changes
eviction=(threads_min=X)1
eviction=(threads_max=X)4
eviction_checkpoint_target=X5
eviction_dirty_target=X80
eviction_dirty_trigger=X95
eviction_target=X80
eviction_trigger=X95

Comments

  1. This is very useful, thanks for the insights!

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Where do I change the default settings if I need ?
    I searched MongoDB documentation and didn't find any way to do so.

    ReplyDelete

Post a Comment