Reputation: 47
MongoDB uses WiredTiger storage engine for processing writes and it also uses 50% of available cache. So I want to understand how wiredTiger uses the cache for writing data. And why by default it requires 50% of cache? If the cache size is decreased to 10-20% how much impact it will make on writes ?
Upvotes: 0
Views: 412
Reputation: 1861
For MongoDB version 3.2 on, WiredTiger is the default storage engine.
WiredTiger performs locking at the document level. This reduces locks. And, it lets us read or update multiple documents in a collection concurrently.
The WiredTiger storage engine is a significant improvement over MMAPv1 in performance and concurrency. It also offers the benefits of compression and encryption.
By default, MongoDB will reserve 50 percent of the available memory for the WiredTiger data cache.The size of this cache is important to ensure WiredTiger performs adequately. A good rule of thumb is that the size of the cache should be big enough to hold the entire application working set.
db.serverStatus().wiredTiger.cache
wiredTiger.cache.maximum
bytes configured: This is the maximum cache size.
wiredTiger.cache.bytes
currently in the cache – This is the size of the data currently in the cache. This should not be greater than the maximum bytes configured.
wiredTiger.cache.tracked
dirty bytes in the cache – This is the size of the dirty data in the cache. This value should be less than the bytes currently in the cache value.
Looking at these values, we can determine if we need to up the size of the cache for our instance. Additionally, we can look at the wiredTiger.cache.bytes
read into cache value for read-heavy applications. If this value is consistently high, increasing the cache size may improve overall read performance.
Upvotes: 1