[CP] adjust cache map node clean

This commit is contained in:
z404289981
2023-11-06 07:13:31 +00:00
committed by ob-robot
parent a7422df219
commit c1fb7fe9f8
2 changed files with 5 additions and 1 deletions

View File

@ -231,7 +231,10 @@ int ObKVGlobalCache::init(
cache_num_ = 0;
stopped_ = false;
mem_limit_getter_ = mem_limit_getter;
map_once_clean_num_ = min(MAX_MAP_ONCE_CLEAN_NUM, bucket_num / MAP_ONCE_CLEAN_RATIO);
map_once_clean_num_ = bucket_num / MAP_ONCE_CLEAN_RATIO;
if (map_once_clean_num_ > MAX_MAP_ONCE_CLEAN_NUM) {
map_once_clean_num_ = MAX(MAX_MAP_ONCE_CLEAN_NUM, map_once_clean_num_/EXPAND_MAP_ONCE_CLEAN_RATIO);
}
map_once_replace_num_ = min(MAX_MAP_ONCE_REPLACE_NUM, bucket_num / MAP_ONCE_REPLACE_RATIO);
inited_ = true;
#ifdef ENABLE_DEBUG_LOG

View File

@ -239,6 +239,7 @@ private:
static const int64_t MAP_ONCE_CLEAN_RATIO = 50; // 50 * 0.2 = 10s
static const int64_t MAP_ONCE_REPLACE_RATIO = 100; // 100 * 0.2 = 20s
static const int64_t MAX_MAP_ONCE_CLEAN_NUM = 200000; // 200K
static const int64_t EXPAND_MAP_ONCE_CLEAN_RATIO = 10;
static const int64_t MAX_MAP_ONCE_REPLACE_NUM = 100000; // 100K
static const int64_t TIMER_SCHEDULE_INTERVAL_US = 800 * 1000;
static const int64_t WORKING_SET_LIMIT_PERCENTAGE = 5;