Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 868c077

Browse files
zuiderkwastPingXie
authored andcommittedSep 14, 2024
Rewrite lazyfree docs in valkey.conf to reflect that lazy is now default (valkey-io#983)
Before this doc update, the comments in valkey.conf said that DEL is a blocking command, and even refered to other synchronous freeing as "in a blocking way, like if DEL was called". This has now become confusing and incorrect, since DEL is now non-blocking by default. The comments also mentioned too much about the "old default" and only later explain that the "new default" is non-blocking. This doc update focuses on the current default and expresses it like "Starting from Valkey 8.0, lazy freeing is enabled by default", rather than using words like old and new. This is a follow-up to valkey-io#913. --------- Signed-off-by: Viktor Söderqvist <[email protected]> Signed-off-by: Ping Xie <[email protected]>
1 parent c635b03 commit 868c077

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed
 

‎valkey.conf

+17-17
Original file line numberDiff line numberDiff line change
@@ -1248,24 +1248,25 @@ acllog-max-len 128
12481248

12491249
############################# LAZY FREEING ####################################
12501250

1251-
# The server has two primitives to delete keys. One is called DEL and is a blocking
1252-
# deletion of the object. It means that the server stops processing new commands
1251+
# When keys are deleted, the served has historically freed their memory using
1252+
# blocking operations. It means that the server stopped processing new commands
12531253
# in order to reclaim all the memory associated with an object in a synchronous
12541254
# way. If the key deleted is associated with a small object, the time needed
12551255
# in order to execute the DEL command is very small and comparable to most other
12561256
# O(1) or O(log_N) commands in the server. However if the key is associated with an
12571257
# aggregated value containing millions of elements, the server can block for
12581258
# a long time (even seconds) in order to complete the operation.
12591259
#
1260-
# For the above reasons the server also offers non blocking deletion primitives
1261-
# such as UNLINK (non blocking DEL) and the ASYNC option of FLUSHALL and
1262-
# FLUSHDB commands, in order to reclaim memory in background. Those commands
1263-
# are executed in constant time. Another thread will incrementally free the
1264-
# object in the background as fast as possible.
1260+
# For the above reasons, lazy freeing (or asynchronous freeing), has been
1261+
# introduced. With lazy freeing, keys are deleted in constant time. Another
1262+
# thread will incrementally free the object in the background as fast as
1263+
# possible.
12651264
#
1266-
# DEL, UNLINK and ASYNC option of FLUSHALL and FLUSHDB are user-controlled.
1267-
# It's up to the design of the application to understand when it is a good
1268-
# idea to use one or the other. However the server sometimes has to
1265+
# Starting from Valkey 8.0, lazy freeing is enabled by default. It is possible
1266+
# to retain the synchronous freeing behaviour by setting the lazyfree related
1267+
# configuration directives to 'no'.
1268+
1269+
# Commands like DEL, FLUSHALL and FLUSHDB delete keys, but the server can also
12691270
# delete keys or flush the whole database as a side effect of other operations.
12701271
# Specifically the server deletes objects independently of a user call in the
12711272
# following scenarios:
@@ -1285,19 +1286,18 @@ acllog-max-len 128
12851286
# its primary, the content of the whole database is removed in order to
12861287
# load the RDB file just transferred.
12871288
#
1288-
# In all the above cases the old default is to delete objects in a blocking way,
1289-
# like if DEL was called. Now the new default is release memory in a non-blocking
1290-
# way like if UNLINK was called.
1289+
# In all the above cases, the default is to release memory in a non-blocking
1290+
# way.
12911291

12921292
lazyfree-lazy-eviction yes
12931293
lazyfree-lazy-expire yes
12941294
lazyfree-lazy-server-del yes
12951295
replica-lazy-flush yes
12961296

1297-
# It is also possible, for the case when to replace the user code DEL calls
1298-
# with UNLINK calls is not easy, to modify the default behavior of the DEL
1299-
# command to act exactly like UNLINK, using the following configuration
1300-
# directive:
1297+
# For keys deleted using the DEL command, lazy freeing is controlled by the
1298+
# configuration directive 'lazyfree-lazy-user-del'. The default is 'yes'. The
1299+
# UNLINK command is identical to the DEL command, except that UNLINK always
1300+
# frees the memory lazily, regardless of this configuration directive:
13011301

13021302
lazyfree-lazy-user-del yes
13031303

0 commit comments

Comments
 (0)
Please sign in to comment.