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
Setting | Description |
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=X | Perform 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=X | Perform 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=X | Trigger 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=X | Perform eviction in worker threads when the cache contains at least this much content, expressed as a percentage of the total cache size. |
eviction_trigger=X | Trigger 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
Setting | Default | Related server changes |
eviction=(threads_min=X) | 4 | SERVER-28026 |
eviction=(threads_max=X) | 4 | |
eviction_checkpoint_target=X | 15 | |
eviction_dirty_target=X | 5 | |
eviction_dirty_trigger=X | 20 | |
eviction_target=X | 80 | |
eviction_trigger=X | 95 | |
MongoDB v3.2.10
Setting | Default | Related server changes |
eviction=(threads_min=X) | 1 | |
eviction=(threads_max=X) | 4 | |
eviction_checkpoint_target=X | 15 | WT-2903 |
eviction_dirty_target=X | 5 | WT-2764 |
eviction_dirty_trigger=X | 20 | WT-2764 |
eviction_target=X | 80 | |
eviction_trigger=X | 95 | |
Prior to MongoDB v3.2.10
Setting | Default | Related server changes |
eviction=(threads_min=X) | 1 | |
eviction=(threads_max=X) | 4 | |
eviction_checkpoint_target=X | 5 | |
eviction_dirty_target=X | 80 | |
eviction_dirty_trigger=X | 95 | |
eviction_target=X | 80 | |
eviction_trigger=X | 95 |
This is very useful, thanks for the insights!
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteWhere do I change the default settings if I need ?
ReplyDeleteI searched MongoDB documentation and didn't find any way to do so.