This commit is contained in:
Alex Cope 2023-06-28 23:19:34 -07:00 committed by Malavan Sotheeswaran
parent e3a1ea3928
commit ce70e8cd0c
2 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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<size_t>(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<size_t>(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) {