with config
This commit is contained in:
parent
6efe344587
commit
4e22068f2f
@ -2953,6 +2953,7 @@ standardConfig configs[] = {
|
||||
createBoolConfig("soft-shutdown", NULL, MODIFIABLE_CONFIG, g_pserver->config_soft_shutdown, 0, NULL, NULL),
|
||||
createBoolConfig("flash-disable-key-cache", NULL, MODIFIABLE_CONFIG, g_pserver->flash_disable_key_cache, 0, NULL, NULL),
|
||||
createSizeTConfig("semi-ordered-set-bucket-size", NULL, MODIFIABLE_CONFIG, 0, 1024, g_semiOrderedSetTargetBucketSize, 0, INTEGER_CONFIG, NULL, NULL),
|
||||
createIntConfig("force-eviction-percent", NULL, MODIFIABLE_CONFIG, 0, 100, g_pserver->force_eviction_percent, 0, INTEGER_CONFIG, NULL, NULL),
|
||||
|
||||
#ifdef USE_OPENSSL
|
||||
createIntConfig("tls-port", NULL, MODIFIABLE_CONFIG, 0, 65535, g_pserver->tls_port, 0, INTEGER_CONFIG, NULL, updateTLSPort), /* TCP port. */
|
||||
|
@ -425,10 +425,11 @@ int getMaxmemoryState(size_t *total, size_t *logical, size_t *tofree, float *lev
|
||||
if (g_pserver->FRdbSaveInProgress())
|
||||
maxmemory = static_cast<size_t>(maxmemory*1.2);
|
||||
|
||||
/* If there is less than 10% free system memory, force eviction */
|
||||
/* If there is less than a configurable percent of free system memory, force eviction */
|
||||
bool mem_rss_max_exceeded;
|
||||
if (g_pserver->cron_malloc_stats.sys_total) {
|
||||
size_t mem_rss_max = static_cast<size_t>(g_pserver->cron_malloc_stats.sys_total * 0.9);
|
||||
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;
|
||||
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) {
|
||||
/* This will always set maxmemory < mem_reported */
|
||||
|
@ -2571,6 +2571,7 @@ struct redisServer {
|
||||
int maxmemory_policy; /* Policy for key eviction */
|
||||
int maxmemory_samples; /* Precision of random sampling */
|
||||
int maxmemory_eviction_tenacity;/* Aggressiveness of eviction processing */
|
||||
int force_eviction_percent; /* Force eviction when this percent of system memory is remaining */
|
||||
int lfu_log_factor; /* LFU logarithmic counter factor. */
|
||||
int lfu_decay_time; /* LFU counter decay factor. */
|
||||
long long proto_max_bulk_len; /* Protocol bulk length maximum size. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user