Skip to content

Commit edce58c

Browse files
Tarte12zuiderkwast
andauthored
Improve listpack threshold guidance in valkey.conf (valkey-io#3419)
Fixes valkey-io#3299 Add brief guidance in valkey.conf explaining what the listpack thresholds control and the memory/CPU tradeoff when tuning them. --------- Signed-off-by: Tarte <emprimula@gmail.com> Signed-off-by: KimHuiSu <101166683+Tarte12@users.noreply.github.com> Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
1 parent 215b6c1 commit edce58c

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

valkey.conf

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,15 +2279,30 @@ notify-keyspace-events ""
22792279

22802280
############################### ADVANCED CONFIG ###############################
22812281

2282-
# Hashes are encoded using a memory efficient data structure when they have a
2283-
# small number of entries, and the biggest entry does not exceed a given
2284-
# threshold. These thresholds can be configured using the following directives.
2282+
# Valkey uses listpacks for some small hashes, sets, sorted sets, and
2283+
# list nodes.
2284+
# A listpack is a compact, memory-efficient representation that stores multiple
2285+
# elements in a contiguous block of memory. This usually saves memory, but
2286+
# larger listpacks can make some updates or lookups more expensive because more
2287+
# data may need to be traversed or rewritten.
2288+
#
2289+
# The "*-max-listpack-entries" settings limit how many entries can stay in a
2290+
# listpack. The "*-max-listpack-value" settings limit the largest element,
2291+
# field, or value that can stay in a listpack.
2292+
#
2293+
# This section also includes related settings for list compression and for sets
2294+
# that can use intset encoding instead of listpacks.
2295+
#
2296+
# Change these only after measuring your actual dataset and workload.
2297+
#
2298+
# Hashes use listpacks when they have a small number of entries, and the
2299+
# biggest field or value does not exceed the following limits.
22852300
hash-max-listpack-entries 512
22862301
hash-max-listpack-value 64
22872302

2288-
# Lists are also encoded in a special way to save a lot of space.
2289-
# The number of entries allowed per internal list node can be specified
2290-
# as a fixed maximum size or a maximum number of elements.
2303+
# Lists are stored as quicklists, where each internal node is a listpack.
2304+
# The number of entries allowed per listpack node can be specified as a fixed
2305+
# maximum size or a maximum number of elements.
22912306
# For a fixed maximum size, use -5 through -1, meaning:
22922307
# -5: max size: 64 Kb <-- not recommended for normal workloads
22932308
# -4: max size: 32 Kb <-- not recommended
@@ -2301,7 +2316,7 @@ hash-max-listpack-value 64
23012316
list-max-listpack-size -2
23022317

23032318
# Lists may also be compressed.
2304-
# Compress depth is the number of quicklist ziplist nodes from *each* side of
2319+
# Compress depth is the number of quicklist nodes from *each* side of
23052320
# the list to *exclude* from compression. The head and tail of the list
23062321
# are always uncompressed for fast push/pop operations. Settings are:
23072322
# 0: disable all list compression
@@ -2316,23 +2331,18 @@ list-max-listpack-size -2
23162331
# etc.
23172332
list-compress-depth 0
23182333

2319-
# Sets have a special encoding when a set is composed
2320-
# of just strings that happen to be integers in radix 10 in the range
2321-
# of 64 bit signed integers.
2322-
# The following configuration setting sets the limit in the size of the
2323-
# set in order to use this special memory saving encoding.
2334+
# Sets containing only integers can use intset encoding.
2335+
# The following setting limits the largest set that can use intset encoding.
23242336
set-max-intset-entries 512
23252337

2326-
# Sets containing non-integer values are also encoded using a memory efficient
2327-
# data structure when they have a small number of entries, and the biggest entry
2328-
# does not exceed a given threshold. These thresholds can be configured using
2329-
# the following directives.
2338+
# Sets containing non-integer values use listpacks when they have a small
2339+
# number of entries, and the biggest member does not exceed the following
2340+
# limits.
23302341
set-max-listpack-entries 128
23312342
set-max-listpack-value 64
23322343

2333-
# Similarly to hashes and lists, sorted sets are also specially encoded in
2334-
# order to save a lot of space. This encoding is only used when the length and
2335-
# elements of a sorted set are below the following limits:
2344+
# Sorted sets use listpacks when they have a small number of entries, and the
2345+
# biggest member does not exceed the following limits:
23362346
zset-max-listpack-entries 128
23372347
zset-max-listpack-value 64
23382348

0 commit comments

Comments
 (0)