This page describes maxmemory policies and other Redis configurations available for Memorystore for Redis. You do not need to restart your Redis instance if you adjust a configuration.
For instructions on how to modify the configurations listed below, see Configuring Redis Instances .
Maxmemory policies
When your Redis instance memory is full, and a new write comes in, Redis evicts
keys to make room for the write based on your instance's maxmemory policy. The default maxmemory policyfor Memorystore for Redis is volatile-lru
. You
can also use one of the following maxmemory policies:
-
noeviction
: Returns an error when the Redis instance reaches maxmemory. Does not overwrite or evict any data. -
allkeys-lfu
: Available in Redis version 4.0, or later. Evicts the least frequently used (LFU) keys from the entire keyset. -
allkeys-lru
: Evicts the least recently used (LRU) keys from the entire keyset. -
volatile-lfu
: Available in Redis version 4.0, or later. Evicts the least-frequently-used keys that are set with TTL (time to live) expirations. -
volatile-lru
: Evicts the least recently used (LRU) keys that are set with TTL expirations. -
allkeys-random
: Evicts random keys from the entire keyspace. -
volatile-random
: Evicts random keys from among those set with TTL expirations. -
volatile-ttl
: Evicts the keys with the shortest TTL from among those set with TTL expirations.
Modifiable configuration parameters
You can modify the following parameters when creating or updating a Memorystore for Redis instance.
no
(default)yes
1-100
Default is
16
no
disables this configuration. For more information, see REDIS.CONF
no
(default)yes
no
disables this configuration. For more information, see REDIS.CONF
no
(default)yes
no
disables this configuration. For more information, see REDIS.CONF
no
(default)yes
no
disables this configuration. For more information, see REDIS.CONF
no
(default)yes
(default=1)
lfu-log-factor
configuration works in the REDIS.CONF
file.(default=10)
Total memory usage of normal/pubsub clients. If the limit is hit, the client with most memory usage will be evicted
0%
(no limit). Acceptable values are integer percent
values between 0%
and 100%
. Represents the percentage
of instance maxmemory to which client storage is limited.maxmemory-gb
to 8
, your eviction policy takes effect when your data occupies 8
GB of your instance memory. This leaves you 2 GB of memory as overhead. By
default maxmemory-gb
is set to your instance capacity. For details
on how to best use the maxmemory-gb
configuration, see the
Memorystore memory management best practices
.This configuration is displayed as
maxmemory-percent
in the
Google Cloud console. When using the console, you set maxmemory-percent
as percentage of your instance capacity instead of a specific number of GBs.Examples:
10
designates a maxmemory-gb
of 10 GB.1.5
designates a maxmemory-gb
of 1.5 GB.maxmemory-gb
can be reduced to a minimum of 20% of your instance
capacity.maxmemory-gb
limit. Refer to Maxmemory policies
for a description of the behavior of
each policy.For additional information about the open source Redis maxmemory policies, see the open source Redis LRU cache page
noeviction
allkeys-lru
volatile-lru
(default)allkeys-random
volatile-random
volatile-ttl
volatile-lfu
(Redis version 4.0 and higher)allkeys-lfu
(Redis version 4.0 and higher)
""
(default)K
Keyspace events, published with __keyspace@
E
Keyevent events, published with __keyevent@
g
Generic commands (non-type specific) like DEL, EXPIRE, or RENAME
$
String commands
l
List commands
s
Set commands
h
Hash commands
z
Sorted set commands
x
Expired events (events generated every time a key expires)
e
Evicted events (events generated when a key is evicted for maxmemory)
A
Alias for g$lshzxe, so that the "AKE" string means all the events.
stream-node-max-bytes
stream-node-max-bytes
parameter designates the maximum number of bytes available to store items in a single tree node. Once this limit is reached new items are stored in a new tree node.(default=4096)
0 designates a tree node of unlimited size.
stream-node-max-entries
stream-node-max-entries
parameter designates the number of items that can be stored in a single node. When this limit is reached, new items are stored in a new tree node.(default=100)
0 designates a tree node with an unlimited number of items.
timeout
timeout
is set to 0
idle clients do not timeout and remain connected until the client issues the termination.Integers >= 120
Unit = seconds
Unmodifiable configuration parameters
The following table lists the Redis configuration parameters that you cannot modify in Memorystore for Redis and their default values. See the Redis configuration documentation for detailed information about these configuration parameters.
Parameter | Default Value |
---|---|
lua-time-limit
|
5000 |
hash-max-ziplist-entries
|
2048 |
hash-max-ziplist-value
|
1024 |
list-max-ziplist-size
|
-2 |
list-compress-depth .
|
0 |
set-max-intset-entries
|
512 |
zset-max-ziplist-entries
|
1024 |
zset-max-ziplist-value
|
1024 |
hll-sparse-max-byte
|
3000 |
activerehashing
|
yes |
hz
|
10 |
databases
|
16 |
maxclients
|
65000 |
slowlog-log-slower-than
|
10000 |
slowlog-max-len
|
128 |
repl-diskless-load
|
swapdb |
io-threads-do-reads
|
yes |
What's next
- Learn more about Redis configurations on the open source Redis configuration page