summaryrefslogtreecommitdiff
path: root/items.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2017-06-24 01:07:03 -0700
committerdormando <dormando@rydia.net>2017-06-24 01:07:03 -0700
commit1174994a6cb977785fdf38aea915d23c1cfb5a56 (patch)
treea487bdea1b9eb1c96bcb65ee0e049330efefed39 /items.c
parentb52da9e98add7cf6d72bb905acf003fea4b6d701 (diff)
downloadmemcached-1174994a6cb977785fdf38aea915d23c1cfb5a56.tar.gz
hot_max_age is now hot_max_factor
defaults at 20% of COLD age. hot_max_age was added because many people's caches were sitting at 32% memory utilized (exactly the size of hot). Capping the LRU's by percentage and age would promote some fairness, but I made a mistake making WARM dynamic but HOT static. This is now fixed.
Diffstat (limited to 'items.c')
-rw-r--r--items.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/items.c b/items.c
index 1ce00da..fdfa38d 100644
--- a/items.c
+++ b/items.c
@@ -1341,21 +1341,23 @@ static int lru_maintainer_juggle(const int slabs_clsid) {
rel_time_t cold_age = 0;
rel_time_t hot_age = 0;
+ rel_time_t warm_age = 0;
/* If LRU is in flat mode, force items to drain into COLD via max age */
if (settings.lru_segmented) {
- hot_age = settings.hot_max_age;
pthread_mutex_lock(&lru_locks[slabs_clsid|COLD_LRU]);
if (tails[slabs_clsid|COLD_LRU]) {
cold_age = current_time - tails[slabs_clsid|COLD_LRU]->time;
}
pthread_mutex_unlock(&lru_locks[slabs_clsid|COLD_LRU]);
+ hot_age = cold_age * settings.hot_max_factor;
+ warm_age = cold_age * settings.warm_max_factor;
}
/* Juggle HOT/WARM up to N times */
for (i = 0; i < 500; i++) {
int do_more = 0;
if (lru_pull_tail(slabs_clsid, HOT_LRU, total_bytes, LRU_PULL_CRAWL_BLOCKS, hot_age) ||
- lru_pull_tail(slabs_clsid, WARM_LRU, total_bytes, LRU_PULL_CRAWL_BLOCKS, cold_age * settings.warm_max_factor)) {
+ lru_pull_tail(slabs_clsid, WARM_LRU, total_bytes, LRU_PULL_CRAWL_BLOCKS, warm_age)) {
do_more++;
}
if (settings.lru_segmented) {