diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2016-06-30 16:36:52 +1000 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-06-30 16:36:52 +1000 |
commit | 716cfbfc106f1687e5591de3ab3a74daa67ad55f (patch) | |
tree | ced6a4fa706ba51ba8ae4dea78f8e28b4e552749 /src/conn | |
parent | 65e0e4d1556d0261dbc6e2047d800b3becc10484 (diff) | |
download | mongo-716cfbfc106f1687e5591de3ab3a74daa67ad55f.tar.gz |
WT-2665 Limit allocator fragmentation from the WiredTiger cache (#2799)
* Add a statistic for the amount of cache used for page images vs other objects
* Reset the "maximum page size" statistic each checkpoint
* Add a separate queue for urgent eviction, replaces existing WOULD_BLOCK eviction mode
Until now, the eviction server has had to walk the cache to find pages that
would otherwise block application threads. This change allows threads to put
those pages directly on a queue that is checked before ordinary LRU eviction.
* Don't queue pages for urgent eviction when eviction is disabled in a tree.
Decouple evict_queue_lock and the individual queue's evict_lock in
__evict_get_ref. Don't block the eviction server if there are many
application threads waiting on a queue.
* Take care with the urgent queue.
Entries in the urgent queue cannot be skipped or they will not be considered again.
Diffstat (limited to 'src/conn')
-rw-r--r-- | src/conn/conn_cache.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/conn/conn_cache.c b/src/conn/conn_cache.c index aaed18f0323..4fccac88bc1 100644 --- a/src/conn/conn_cache.c +++ b/src/conn/conn_cache.c @@ -176,6 +176,10 @@ __wt_cache_create(WT_SESSION_IMPL *session, const char *cfg[]) &cache->evict_queues[i].evict_lock, "cache eviction")); } + /* Ensure there is always a non-NULL current queue. */ + cache->evict_current_queue = + &cache->evict_queues[WT_EVICT_URGENT_QUEUE + 1]; + /* * We get/set some values in the cache statistics (rather than have * two copies), configure them. @@ -213,21 +217,25 @@ __wt_cache_stats_update(WT_SESSION_IMPL *session) WT_STAT_SET(session, stats, cache_bytes_max, conn->cache_size); WT_STAT_SET(session, stats, cache_bytes_inuse, inuse); - WT_STAT_SET(session, stats, cache_overhead, cache->overhead_pct); - WT_STAT_SET( - session, stats, cache_pages_inuse, __wt_cache_pages_inuse(cache)); + WT_STAT_SET( session, stats, cache_bytes_dirty, __wt_cache_dirty_inuse(cache)); - WT_STAT_SET(session, stats, - cache_eviction_maximum_page_size, cache->evict_max_page_size); - WT_STAT_SET(session, stats, cache_pages_dirty, cache->pages_dirty); - + WT_STAT_SET( + session, stats, cache_bytes_image, __wt_cache_bytes_image(cache)); + WT_STAT_SET( + session, stats, cache_pages_inuse, __wt_cache_pages_inuse(cache)); WT_STAT_SET( session, stats, cache_bytes_internal, cache->bytes_internal); + WT_STAT_SET(session, stats, cache_bytes_leaf, leaf); + WT_STAT_SET( + session, stats, cache_bytes_other, __wt_cache_bytes_other(cache)); WT_STAT_SET( session, stats, cache_bytes_overflow, cache->bytes_overflow); - WT_STAT_SET(session, stats, cache_bytes_leaf, leaf); + + WT_STAT_SET(session, stats, + cache_eviction_maximum_page_size, cache->evict_max_page_size); + WT_STAT_SET(session, stats, cache_pages_dirty, cache->pages_dirty); /* * The number of files with active walks ~= number of hazard pointers @@ -286,6 +294,7 @@ __wt_cache_destroy(WT_SESSION_IMPL *session) __wt_spin_destroy(session, &cache->evict_queues[i].evict_lock); __wt_free(session, cache->evict_queues[i].evict_queue); } + __wt_free(session, conn->cache); return (ret); } |