summaryrefslogtreecommitdiff
path: root/src/expire.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-11-14 18:27:37 +0100
committerantirez <antirez@gmail.com>2019-11-14 18:28:01 +0100
commit2f6fe5ce3adb84cfc7506577c49504a8a65aaf2b (patch)
tree031673bb3c558718d30f8eb7e08634b08e187a00 /src/expire.c
parent8d50a8327e9f77f70ac7c11edd41a74a193ed830 (diff)
downloadredis-2f6fe5ce3adb84cfc7506577c49504a8a65aaf2b.tar.gz
Expire cycle: introduce the new state needed for the new algo.
Diffstat (limited to 'src/expire.c')
-rw-r--r--src/expire.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/expire.c b/src/expire.c
index 598b27f96..3d0bae249 100644
--- a/src/expire.c
+++ b/src/expire.c
@@ -95,6 +95,10 @@ int activeExpireCycleTryExpire(redisDb *db, dictEntry *de, long long now) {
* executed, where the time limit is a percentage of the REDIS_HZ period
* as specified by the ACTIVE_EXPIRE_CYCLE_SLOW_TIME_PERC define. */
+#define ACTIVE_EXPIRE_CYCLE_LOOKUPS_PER_LOOP 20 /* Loopkups per loop. */
+#define ACTIVE_EXPIRE_CYCLE_FAST_DURATION 1000 /* Microseconds. */
+#define ACTIVE_EXPIRE_CYCLE_SLOW_TIME_PERC 25 /* Percentage of CPU to use. */
+
void activeExpireCycle(int type) {
/* This function has some global state in order to continue the work
* incrementally across calls. */
@@ -231,6 +235,7 @@ void activeExpireCycle(int type) {
}
elapsed = ustime()-start;
+ server.stat_expire_cycle_time_used += elapsed;
latencyAddSampleIfNeeded("expire-cycle",elapsed/1000);
/* Update our estimate of keys existing but yet to be expired.