diff --git a/keydb.conf b/keydb.conf index 02e97d4be..1a006fcd3 100644 --- a/keydb.conf +++ b/keydb.conf @@ -1145,8 +1145,9 @@ acllog-max-len 128 # # active-expire-effort 1 -# Force evictions when used system memory reaches X% of total system memory. -# This is useful as a safeguard to prevent OOM kills (0 to disable). +# Force evictions when RSS memory reaches this percent of total system memory. +# This is useful as a safeguard to prevent OOM kills when RSS overhead is +# significant (0 to disable). # # force-eviction-percent 0 diff --git a/src/evict.cpp b/src/evict.cpp index bdbc88276..75b4e19a1 100644 --- a/src/evict.cpp +++ b/src/evict.cpp @@ -430,10 +430,10 @@ int getMaxmemoryState(size_t *total, size_t *logical, size_t *tofree, float *lev if (g_pserver->FRdbSaveInProgress() && !cserver.fForkBgSave) maxmemory = static_cast(maxmemory*1.2); - /* If there is less than a configurable percent of free system memory, force eviction */ + /* If rss memory exceeds configurable percent of system memory, force eviction */ bool mem_rss_max_exceeded; if (g_pserver->force_eviction_percent && g_pserver->cron_malloc_stats.sys_total) { - float sys_total_ratio = (float)(100 - g_pserver->force_eviction_percent)/100; + float sys_total_ratio = (float)(g_pserver->force_eviction_percent)/100; size_t mem_rss_max = static_cast(g_pserver->cron_malloc_stats.sys_total * sys_total_ratio); mem_rss_max_exceeded = g_pserver->cron_malloc_stats.process_rss > mem_rss_max; if (mem_rss_max_exceeded) {