Redis configurations

This page describes the available options for Redis configurations that can be changed on Cloud Memorystore instances and the default values chosen for the ones that cannot.

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 policy for Cloud Memorystore 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 Cloud Memorystore instance. You do not need to restart your instance after modifying any of the following parameters. For more information about how to change these configurations, see Configuring Redis Instances.

Parameter Description Acceptable values
activedefrag Redis version 4.0, or later. Works to free up instance memory tied up by standard OSS Redis memory fragmentation behavior. no (default)
yes
lfu-decay-time Redis version 4.0, or later. The time, in minutes, before the LFU frequency counter for a given key will be divided by two (or, if the counter is < 10, decremented by 1). See the REDIS.CONF file for additional information. Positive integers of the 'long' data type
(default=1)
lfu-log-factor Redis version 4.0, or later. Determines how the frequency counter represents key hits. Before you modify the default configuration, read about how the lfu-log-factor configuration works in the REDIS.CONF file. Positive integers of the 'long' data type
(default=10)
maxmemory-policy Specifies the behavior Redis follows when the memory size limit is reached. See the LRU cache page on the Redis site for more information. noeviction
allkeys-lru
volatile-lru (default)
allkeys-random
volatile-random
Volatile-ttl
notify-keyspace-events Allows clients to subscribe to notifications on certain keyspace events. See the Redis Keyspace Notifications page on the Redis site for more information. "" (default)
K
Keyspace events, published with __keyspace@__ prefix.
E
Keyevent events, published with __keyevent@__ prefix.
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.

Unmodifiable configuration parameters

The following table lists the Redis configuration parameters that you cannot modify in Cloud Memorystore 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

Blocked Redis commands

  • BGREWRITEAOF
  • BGSAVE
  • CLIENT
  • CLUSTER
  • COMMAND
  • CONFIG
  • DEBUG
  • OBJECT
  • MIGRATE
  • MONITOR
  • SHUTDOWN
  • SLAVEOF
  • LASTSAVE
  • SAVE
Kunde den här sidan hjälpa dig? Berätta:

Skicka feedback om ...

Google Cloud Memorystore for Redis