summaryrefslogtreecommitdiff
path: root/redis.conf
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2012-12-14 17:10:40 +0100
committerantirez <antirez@gmail.com>2012-12-14 17:10:40 +0100
commitf1481d4a03e96c71a664bafadf0241e88794ca60 (patch)
treeac7e2bed72dc92b8629370561a38878a99d96cbb /redis.conf
parenta4d68dc5419121660bd8f992d58e1e46075a371a (diff)
downloadredis-f1481d4a03e96c71a664bafadf0241e88794ca60.tar.gz
serverCron() frequency is now a runtime parameter (was REDIS_HZ).
REDIS_HZ is the frequency our serverCron() function is called with. A more frequent call to this function results into less latency when the server is trying to handle very expansive background operations like mass expires of a lot of keys at the same time. Redis 2.4 used to have an HZ of 10. This was good enough with almost every setup, but the incremental key expiration algorithm was working a bit better under *extreme* pressure when HZ was set to 100 for Redis 2.6. However for most users a latency spike of 30 milliseconds when million of keys are expiring at the same time is acceptable, on the other hand a default HZ of 100 in Redis 2.6 was causing idle instances to use some CPU time compared to Redis 2.4. The CPU usage was in the order of 0.3% for an idle instance, however this is a shame as more energy is consumed by the server, if not important resources. This commit introduces HZ as a runtime parameter, that can be queried by INFO or CONFIG GET, and can be modified with CONFIG SET. At the same time the default frequency is set back to 10. In this way we default to a sane value of 10, but allows users to easily switch to values up to 500 for near real-time applications if needed and if they are willing to pay this small CPU usage penalty.
Diffstat (limited to 'redis.conf')
-rw-r--r--redis.conf17
1 files changed, 17 insertions, 0 deletions
diff --git a/redis.conf b/redis.conf
index 751a3eb04..01abdbbfa 100644
--- a/redis.conf
+++ b/redis.conf
@@ -548,6 +548,23 @@ client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
+# Redis calls an internal function to perform many background tasks, like
+# closing connections of clients in timeot, purging expired keys that are
+# never requested, and so forth.
+#
+# Not all tasks are perforemd with the same frequency, but Redis checks for
+# tasks to perform accordingly to the specified "hz" value.
+#
+# By default "hz" is set to 10. Raising the value will use more CPU when
+# Redis is idle, but at the same time will make Redis more responsive when
+# there are many keys expiring at the same time, and timeouts may be
+# handled with more precision.
+#
+# The range is between 1 and 500, however a value over 100 is usually not
+# a good idea. Most users should use the default of 10 and raise this up to
+# 100 only in environments where very low latency is required.
+hz 10
+
################################## INCLUDES ###################################
# Include one or more other config files here. This is useful if you