summaryrefslogtreecommitdiff
path: root/items.c
diff options
context:
space:
mode:
authorIliya <vnsavage@gmail.com>2022-03-21 15:20:34 +0200
committerdormando <dormando@rydia.net>2022-08-22 12:56:09 -0700
commite183fa37d7bbabd6499b73afcc39e2c579bebfae (patch)
treeeafe4431018e2a7f788ca884ea6fcdab7c604bd3 /items.c
parent2004865efe1e8da24f7182b233246298ed5cf56e (diff)
downloadmemcached-e183fa37d7bbabd6499b73afcc39e2c579bebfae.tar.gz
Improve Slab Automove behavior
- Skip using crawler items when calculating the automover age stats as they can severly skew the ages in the stats to the point of completely starving particular slabs - Include the current window data in the window sum so we don't free pages that are actually needed - this also matches the python script behavior - Reset young / old when interrupting the automove decision loop so we don't accidentally move things which we didn't mean to
Diffstat (limited to 'items.c')
-rw-r--r--items.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/items.c b/items.c
index 65de923..e5347cc 100644
--- a/items.c
+++ b/items.c
@@ -660,10 +660,17 @@ void fill_item_stats_automove(item_stats_automove *am) {
i = n | COLD_LRU;
pthread_mutex_lock(&lru_locks[i]);
cur->evicted = itemstats[i].evicted;
- if (tails[i]) {
- cur->age = current_time - tails[i]->time;
- } else {
+ if (!tails[i]) {
cur->age = 0;
+ } else if (tails[i]->nbytes == 0 && tails[i]->nkey == 0 && tails[i]->it_flags == 1) {
+ /* it's a crawler, check previous entry */
+ if (tails[i]->prev) {
+ cur->age = current_time - tails[i]->prev->time;
+ } else {
+ cur->age = 0;
+ }
+ } else {
+ cur->age = current_time - tails[i]->time;
}
pthread_mutex_unlock(&lru_locks[i]);
}