summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-08-12 12:36:20 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-08-12 12:36:20 +1000
commit5c6437cc2b6ac148e3bf7571ec632d88c9c99ee3 (patch)
tree123738437a3a162610e2724e4d61e616b946484e
parentc3c6ca253d453bbff7e6ad7a497da4c0394f9d4e (diff)
downloadmongo-5c6437cc2b6ac148e3bf7571ec632d88c9c99ee3.tar.gz
Only yield in the eviction server thread if there are multiple eviction workers running and there are candidates in the queue.
-rw-r--r--src/btree/bt_evict.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/btree/bt_evict.c b/src/btree/bt_evict.c
index aa585af0ec5..5f2c50d98a0 100644
--- a/src/btree/bt_evict.c
+++ b/src/btree/bt_evict.c
@@ -762,18 +762,19 @@ __evict_lru(WT_SESSION_IMPL *session, uint32_t flags)
/*
* The eviction server thread doesn't do any actual eviction if there
- * are eviction workers running.
+ * are multiple eviction workers running.
*/
WT_RET(__wt_cond_signal(session, cache->evict_waiter_cond));
- if (S2C(session)->evict_workers > 0) {
+ if (S2C(session)->evict_workers > 1) {
WT_STAT_FAST_CONN_INCR(
session, cache_eviction_server_not_evicting);
/*
- * Give other threads a chance to access the queue before
- * gathering more candidates.
+ * If there are candidates queued, give other threads a chance
+ * to access them before gathering more.
*/
- __wt_yield();
+ if (candidates > 10 && cache->evict_current != NULL)
+ __wt_yield();
} else {
WT_STAT_FAST_CONN_INCR(session, cache_eviction_server_evicting);
WT_RET(__evict_lru_pages(session, 0));