summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-11-04 15:12:05 +1100
committerDavid Hows <howsdav@gmail.com>2016-11-04 15:12:05 +1100
commitf3517c27c2c5ff9bda28a24e44d3cc9ad7b4be3a (patch)
treea28aa7dc955b0af844560e247e7f6ea5b56e5455
parent792186b5ffcd5a2dd82457ae585af6d61ffbd199 (diff)
downloadmongo-f3517c27c2c5ff9bda28a24e44d3cc9ad7b4be3a.tar.gz
WT-2964 Walk for longer when only looking for dirty pages (#3123)
* WT-2964 Alter evict walk to not fill all its slots with internal pages when running in aggressive mode * Test removal of the bump of aggressive by 10 * Change how likely we are to give up, based on if we are looking for dirty or clean pages. Add a stat to track these "dirty give ups" * Lint * Remove statistic. * Simplify decision about when to give up walking for eviction.
-rw-r--r--src/evict/evict_lru.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c
index c12110b0f2a..909fe813f98 100644
--- a/src/evict/evict_lru.c
+++ b/src/evict/evict_lru.c
@@ -910,23 +910,6 @@ __evict_lru_walk(WT_SESSION_IMPL *session)
WT_RET_NOTFOUND_OK(ret);
/*
- * If we found no pages at all during the walk, something is wrong.
- * Be more aggressive next time.
- *
- * Continue on to sort the queue, in case there are pages left from a
- * previous walk.
- */
- if (ret == WT_NOTFOUND) {
- if (F_ISSET(cache,
- WT_CACHE_EVICT_CLEAN_HARD | WT_CACHE_EVICT_DIRTY_HARD))
- cache->evict_aggressive_score = WT_MIN(
- cache->evict_aggressive_score + WT_EVICT_SCORE_BUMP,
- WT_EVICT_SCORE_MAX);
- WT_STAT_CONN_SET(session, cache_eviction_aggressive_set,
- cache->evict_aggressive_score);
- }
-
- /*
* If the queue we are filling is empty, pages are being requested
* faster than they are being queued.
*/
@@ -1296,7 +1279,7 @@ __evict_walk_file(WT_SESSION_IMPL *session, WT_EVICT_QUEUE *queue,
WT_PAGE_MODIFY *mod;
WT_REF *ref;
WT_TXN_GLOBAL *txn_global;
- uint64_t btree_inuse, bytes_per_slot, cache_inuse;
+ uint64_t btree_inuse, bytes_per_slot, cache_inuse, min_pages;
uint64_t pages_seen, pages_queued, refs_walked;
uint32_t remaining_slots, total_slots, walk_flags;
uint32_t target_pages_clean, target_pages_dirty, target_pages;
@@ -1369,6 +1352,16 @@ __evict_walk_file(WT_SESSION_IMPL *session, WT_EVICT_QUEUE *queue,
FLD_SET(walk_flags, WT_READ_PREV);
/*
+ * Examine at least a reasonable number of pages before deciding
+ * whether to give up. When we are only looking for dirty pages,
+ * search the tree for longer.
+ */
+ min_pages = 10 * target_pages;
+ if (F_ISSET(cache, WT_CACHE_EVICT_DIRTY) &&
+ !F_ISSET(cache, WT_CACHE_EVICT_CLEAN))
+ min_pages *= 10;
+
+ /*
* Get some more eviction candidate pages.
*
* !!! Take care terminating this loop.
@@ -1390,9 +1383,10 @@ __evict_walk_file(WT_SESSION_IMPL *session, WT_EVICT_QUEUE *queue,
* no good eviction candidates can be found. Abandon the walk
* if we get into that situation.
*/
- give_up = !__wt_cache_aggressive(session) && pages_seen > 100 &&
+ give_up = !__wt_cache_aggressive(session) &&
+ pages_seen > min_pages &&
(pages_queued == 0 || (pages_seen / pages_queued) >
- (10 * total_slots / target_pages));
+ (min_pages / target_pages));
if (give_up)
break;