Skip to content

Commit 19f6ab5

Browse files
committed
Lazyfree options documented in the example redis.conf.
1 parent 880c606 commit 19f6ab5

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

redis.conf

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ slave-priority 100
444444
# Please note that changing the name of commands that are logged into the
445445
# AOF file or transmitted to slaves may cause problems.
446446

447-
################################### LIMITS ####################################
447+
################################### CLIENTS ####################################
448448

449449
# Set the max number of connected clients at the same time. By default
450450
# this limit is set to 10000 clients, however if the Redis server is not
@@ -457,6 +457,8 @@ slave-priority 100
457457
#
458458
# maxclients 10000
459459

460+
############################## MEMORY MANAGEMENT ################################
461+
460462
# Don't use more memory than the specified amount of bytes.
461463
# When the memory limit is reached Redis will try to remove keys
462464
# according to the eviction policy selected (see maxmemory-policy).
@@ -516,6 +518,55 @@ slave-priority 100
516518
#
517519
# maxmemory-samples 5
518520

521+
############################# LAZY FREEING ####################################
522+
523+
# Redis has two primitives to delete keys. One is called DEL and is a blocking
524+
# deletion of the object. It means that the server stops processing new commands
525+
# in order to reclaim all the memory associated with an object in a synchronous
526+
# way. If the key deleted is associated with a small object, the time needed
527+
# in order to execute th DEL command is very small and comparable to most other
528+
# O(1) or O(log_N) commands in Redis. However if the key is associated with an
529+
# aggregated value containing millions of elements, the server can block for
530+
# a long time (even seconds) in order to complete the operation.
531+
#
532+
# For the above reasons Redis also offers non blocking deletion primitives
533+
# such as UNLINK (non blocking DEL) and the ASYNC option of FLUSHALL and
534+
# FLUSHDB commands, in order to reclaim memory in background. Those commands
535+
# are executed in constant time. Another thread will incrementally free the
536+
# object in the background as fast as possible.
537+
#
538+
# DEL, UNLINK and ASYNC option of FLUSHALL and FLUSHDB are user-controlled.
539+
# It's up to the design of the application to understand when it is a good
540+
# idea to use one or the other. However the Redis server sometimes has to
541+
# delete keys or flush the whole database as a side effect of other operations.
542+
# Specifically Redis deletes objects independently of an user call in the
543+
# following scenarios:
544+
#
545+
# 1) On eviction, because of the maxmemory and maxmemory policy configurations,
546+
# in order to make room for new data, without going over the specified
547+
# memory limit.
548+
# 2) Because of expire: when a key with an associated time to live (see the
549+
# EXPIRE command) must be deleted from memory.
550+
# 3) Because of a side effect of a command that stores data on a key that may
551+
# already exist. For example the RENAME command may delete the old key
552+
# content when it is replaced with another one. Similarly SUNIONSTORE
553+
# or SORT with STORE option may delete existing keys. The SET command
554+
# itself removes any old content of the specified key in order to replace
555+
# it with the specified string.
556+
# 4) During replication, when a slave performs a full resynchronization with
557+
# its master, the content of the whole database is removed in order to
558+
# load the RDB file just transfered.
559+
#
560+
# In all the above cases the default is to delete objects in a blocking way,
561+
# like if DEL was called. However you can configure each case specifically
562+
# in order to instead release memory in a non-blocking way like if UNLINK
563+
# was called, using the following configuration directives:
564+
565+
lazyfree-lazy-eviction no
566+
lazyfree-lazy-expire no
567+
lazyfree-lazy-server-del no
568+
slave-lazy-flush no
569+
519570
############################## APPEND ONLY MODE ###############################
520571

521572
# By default Redis asynchronously dumps the dataset on disk. This mode is

0 commit comments

Comments
 (0)