Configuration Parameters
Redis probabilistic data structures support multiple configuration parameters.
As of Redis 8 in Redis Open Source (Redis 8), configuration parameters for the probabilistic data structures are now set in the following ways:
- At load time via your
redis.conf
file. - At run time (where applicable) using the
CONFIG SET
command.
Also, Redis 8 persists probabilistic configuration parameters just like any other configuration parameters (e.g., using the CONFIG REWRITE
command).
Redis probabilistic data structure configuration parameters
The following table summarizes which Bloom filter configuration parameters can be set at run-time, and compatibility with Redis Software and Redis Cloud.
Parameter name (version < 8.0) |
Parameter name (version ≥ 8.0) |
Run-time | Redis Software |
Redis Cloud |
---|---|---|---|---|
ERROR_RATE | bf-error-rate | ✅ | ✅ Supported |
✅ Flexible & Annual |
bf-expansion-factor | ✅ | |||
INITIAL_SIZE | bf-initial-size | ✅ | ✅ Supported |
✅ Flexible & Annual |
The following table summarizes which Cuckoo filter configuration parameters can be set at run-time, and compatibility with Redis Software and Redis Cloud.
Parameter name (version < 8.0) |
Parameter name (version ≥ 8.0) |
Run-time | Redis Software |
Redis Cloud |
---|---|---|---|---|
cf-bucket-size | ✅ | |||
cf-initial-size | ✅ | |||
cf-expansion-factor | ✅ | |||
CF_MAX_EXPANSIONS | cf-max-expansions | ✅ | ✅ Supported |
✅ Flexible & Annual |
cf-max-iterations | ✅ |
INSERT
family commands with the default values should be used in cases where many small filters exist and the expectation is most will remain at around the default sizes.
Not optimizing a filter for its intended use will result in degradation of performance and memory efficiency.Default parameters for Bloom filters
bf-error-rate
Default false positive rate for Bloom filters.
Type: double
Valid range: (0 .. 1)
. Though the valid range is (0 .. 1)
(corresponding to > 0%
to < 100%
false positive rate), any value greater than 0.25
is treated as 0.25
.
Default: 0.01
bf-expansion-factor
Added in v8.0.0.
Expansion factor for Bloom filters.
Type: integer
Valid range: [0 .. 32768]
.
Default: 2
bf-initial-size
Initial capacity for Bloom filters.
Type: integer
Valid range: [1 .. 1048576]
Default: 100
Default parameters for Cuckoo filters
cf-bucket-size
Added in v8.0.0.
The number of items in each Cuckoo filter bucket.
Type: integer
Valid range: [1 .. 255]
Default: 2
cf-initial-size
Added in v8.0.0.
Cuckoo filter initial capacity.
Type: integer
Valid range: [2*cf-bucket-size .. 1048576]
Default: 1024
cf-expansion-factor
Added in v8.0.0.
Expansion factor for Cuckoo filters.
Type: integer
Valid range: [0 .. 32768]
Default: 1
cf-max-expansions
The maximum number of expansions for Cuckoo filters.
Type: integer
Valid range: [1 .. 65535]
Default: 32
cf-max-iterations
Added in v8.0.0
The maximum number of iterations for Cuckoo filters.
Type: integer
Valid range: [1 .. 65535]
Default: 20
Setting configuration parameters on module load (deprecated)
These methods are deprecated beginning with Redis 8.
Setting configuration parameters at load-time is done by appending arguments after the --loadmodule
argument when starting a server from the command line or after the loadmodule
directive in a Redis config file. For example:
In redis.conf:
loadmodule ./redisbloom.so [OPT VAL]...
From the Redis CLI, using the MODULE LOAD command:
127.0.0.6379> MODULE LOAD redisbloom.so [OPT VAL]...
From the command line:
$ redis-server --loadmodule ./redisbloom.so [OPT VAL]...