make async rehash configurable
This commit is contained in:
parent
68d751046e
commit
570bcb55c7
@ -2982,6 +2982,7 @@ standardConfig configs[] = {
|
|||||||
createSDSConfig("availability-zone", NULL, MODIFIABLE_CONFIG, 0, g_pserver->sdsAvailabilityZone, "", NULL, NULL),
|
createSDSConfig("availability-zone", NULL, MODIFIABLE_CONFIG, 0, g_pserver->sdsAvailabilityZone, "", NULL, NULL),
|
||||||
createIntConfig("overload-protect-percent", NULL, MODIFIABLE_CONFIG, 0, 200, g_pserver->overload_protect_threshold, 0, INTEGER_CONFIG, NULL, NULL),
|
createIntConfig("overload-protect-percent", NULL, MODIFIABLE_CONFIG, 0, 200, g_pserver->overload_protect_threshold, 0, INTEGER_CONFIG, NULL, NULL),
|
||||||
createIntConfig("force-eviction-percent", NULL, MODIFIABLE_CONFIG, 0, 100, g_pserver->force_eviction_percent, 0, INTEGER_CONFIG, NULL, NULL),
|
createIntConfig("force-eviction-percent", NULL, MODIFIABLE_CONFIG, 0, 100, g_pserver->force_eviction_percent, 0, INTEGER_CONFIG, NULL, NULL),
|
||||||
|
createBoolConfig("enable-async-rehash", NULL, MODIFIABLE_CONFIG, g_pserver->enable_async_rehash, 1, NULL, NULL),
|
||||||
|
|
||||||
#ifdef USE_OPENSSL
|
#ifdef USE_OPENSSL
|
||||||
createIntConfig("tls-port", NULL, MODIFIABLE_CONFIG, 0, 65535, g_pserver->tls_port, 0, INTEGER_CONFIG, NULL, updateTLSPort), /* TCP port. */
|
createIntConfig("tls-port", NULL, MODIFIABLE_CONFIG, 0, 65535, g_pserver->tls_port, 0, INTEGER_CONFIG, NULL, updateTLSPort), /* TCP port. */
|
||||||
|
@ -2137,7 +2137,7 @@ void databasesCron(bool fMainThread) {
|
|||||||
::dict *dict = g_pserver->db[rehash_db]->dictUnsafeKeyOnly();
|
::dict *dict = g_pserver->db[rehash_db]->dictUnsafeKeyOnly();
|
||||||
/* Are we async rehashing? And if so is it time to re-calibrate? */
|
/* Are we async rehashing? And if so is it time to re-calibrate? */
|
||||||
/* The recalibration limit is a prime number to ensure balancing across threads */
|
/* The recalibration limit is a prime number to ensure balancing across threads */
|
||||||
if (rehashes_per_ms > 0 && async_rehashes < 131 && !cserver.active_defrag_enabled && cserver.cthreads > 1 && dictSize(dict) > 2048 && dictIsRehashing(dict) && !g_pserver->loading && aeLockContention() > 1) {
|
if (g_pserver->enable_async_rehash && rehashes_per_ms > 0 && async_rehashes < 131 && !cserver.active_defrag_enabled && cserver.cthreads > 1 && dictSize(dict) > 2048 && dictIsRehashing(dict) && !g_pserver->loading && aeLockContention() > 1) {
|
||||||
serverTL->rehashCtl = dictRehashAsyncStart(dict, rehashes_per_ms * ((1000 / g_pserver->hz) / 10)); // Estimate 10% CPU time spent in lock contention
|
serverTL->rehashCtl = dictRehashAsyncStart(dict, rehashes_per_ms * ((1000 / g_pserver->hz) / 10)); // Estimate 10% CPU time spent in lock contention
|
||||||
if (serverTL->rehashCtl)
|
if (serverTL->rehashCtl)
|
||||||
++async_rehashes;
|
++async_rehashes;
|
||||||
|
@ -2306,6 +2306,7 @@ struct redisServer {
|
|||||||
rax *errors; /* Errors table */
|
rax *errors; /* Errors table */
|
||||||
int activerehashing; /* Incremental rehash in serverCron() */
|
int activerehashing; /* Incremental rehash in serverCron() */
|
||||||
int active_defrag_running; /* Active defragmentation running (holds current scan aggressiveness) */
|
int active_defrag_running; /* Active defragmentation running (holds current scan aggressiveness) */
|
||||||
|
int enable_async_rehash = 1; /* Should we use the async rehash feature? */
|
||||||
int cronloops; /* Number of times the cron function run */
|
int cronloops; /* Number of times the cron function run */
|
||||||
char runid[CONFIG_RUN_ID_SIZE+1]; /* ID always different at every exec. */
|
char runid[CONFIG_RUN_ID_SIZE+1]; /* ID always different at every exec. */
|
||||||
int sentinel_mode; /* True if this instance is a Sentinel. */
|
int sentinel_mode; /* True if this instance is a Sentinel. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user