54 KiB
- original_name
en-us_topic_0054235814.html
Configuring Redis-Specific Parameters
On the DCS console, you can configure Redis-specific parameters to keep DCS instances performing optimally.
Note
The default values are already optimized for typical use cases. Reconfiguring parameters is recommended only when necessary.
Prerequisites
The DCS instance you want to configure is in the Running state, and the instance type is single-node or master/standby (Redis parameters of DCS instances in Proxy Cluster mode are not modifiable).
Procedure
Log in to the management console.
Click
in the upper left corner of the management console and select a region.
Click Service List, and choose Database > Distributed Cache Service to launch the DCS console.
In the navigation pane, choose Cache Manager.
On the Cache Manager page, click the name of the DCS instance you want to configure.
A page with details of the DCS instance is displayed.
On the instance details page, click the Parameters tab.
On the Parameters tab page, click Modify.
Modify Redis-specific parameters based on your requirements.
Note
The Redis parameters supported by single-node and master/standby instances are different. The following parameters are only supported by master/standby instances, but are not supported by single-node instances:
- appendfsync
- appendonly
- repl-backlog-size
- repl-backlog-ttl
Table 1 Redis-specific parameters Parameter Description Value Range Default Value appendfsync Controls how often fsync() transfers cached data to the disk. Note that some OSs will perform a complete data transfer but some others only make a "best-effort" attempt.
There are three settings:
no: fsync() is never called. The OS will flush data when it is ready. This mode offers the highest performance.
always: fsync() is called after every write to the AOF. This mode is very slow, but also very safe.
everysec: fsync() is called once per second. This mode provides a compromise between safety and performance.
- no
- always
- everysec
everysec repl-backlog-size The replication backlog size (bytes). The backlog is a buffer that accumulates replica data when replicas are disconnected from the master. When a replica reconnects, a partial synchronization is performed to synchronize the data that was missed while replicas were disconnected. 16,384-1,073,741,824 1,048,576 repl-backlog-ttl The amount of time, in seconds, before the backlog buffer is released, starting from the last a replica was disconnected. The value 0 indicates that the backlog is never released. 0-604,800 3,600 appendonly Indicates whether to log each modification of the instance. By default, data is written to disks asynchronously in Redis. If this function is disabled, recently-generated data might be lost in the event of a power failure. Options:
yes: enabled
no: disabled
- yes
- no
yes maxmemory-policy How DCS will select what to remove when maxmemory is reached.
For more information about this parameter, see
What Is the Default Data Eviction Policy? <en-us_topic_0054235830>
.volatile-lru
allkeys-lru
volatile-random
allkeys-random
volatile-ttl
noeviction
noeviction hash-max-ziplist-entries When the number of entries in hashes is less than the value of this parameter, hashes are encoded using a memory efficient data structure. 1 to 10000 512 hash-max-ziplist-value When the biggest entry in hashes does not exceed the length threshold indicated by this parameter, hashes are encoded using a memory efficient data structure. 1 to 10000 64 list-max-ziplist-entries When the number of entries in lists is less than the value of this parameter, lists are encoded using a memory efficient data structure. 1 to 10000 512 list-max-ziplist-value When the biggest entry in lists does not exceed the length threshold indicated by this parameter, lists are encoded using a memory efficient data structure. 1 to 10000 64 set-max-intset-entries When a set is composed entirely of strings that happen to be integers in radix 10 in the range of 64 bit signed integers, sets are encoded using a memory efficient data structure. 1 to 10000 512 zset-max-ziplist-entries When the number of entries in sorted sets is less than the value of this parameter, sorted sets are encoded using a memory efficient data structure. 1 to 10000 128 zset-max-ziplist-value When the biggest entry in sorted sets does not exceed the length threshold indicated by this parameter, sorted sets are encoded using a memory efficient data structure. 1 to 10000 64 latency-monitor-threshold Only events that run in more time than the configured latency-monitor-threshold will be logged as latency spikes.
- If the latency-monitor-threshold is set to 0, latency monitoring is disabled.
- If the latency-monitor-threshold is set to a value greater than 0, all events blocking the server for a time equal to or greater than the configured latency-monitor-threshold will be logged.
By running the LATENCY command, you can perform operations related to latency monitoring, such as enabling latency monitoring, reporting the latest latency events logged, and obtaining statistical data.
For more information about the latency-monitor-threshold, visit https://redis.io/docs/reference/optimization/latency-monitor/.
0 to 86,400,000 ms 0 reserved-memory-percent Percentage of the maximum available memory reserved for background processes, such as data persistence and replication. 0-80 0 timeout Connection between the client and server (DCS instance) will be closed if the client is idle for the timeout period (measured in seconds). A timeout period of 0 seconds indicates that the timeout function is disabled. 0 to 7200 seconds 0 notify-keyspace-events Keyspace event notification. If this parameter is configured, the Redis Sub/Pub feature will allow clients to receive an event when a Redis data set is modified. If the parameter value is an empty character string, keyspace event notification is disabled.
If the parameter value is a string of multiple characters, keyspace event notification is enabled and each character identifies a class of keyspace events for which Redis will send notifications.
Note
- The parameter value must contain either K or E.
- A is an alias for "g$lshzxe"and cannot be used together with any of the characters "g$lshzxe".
- For example, the value Kl means that Redis will notify Pub/Sub clients about keyspace events and list commands. The value AKE means Redis will notify Pub/Sub clients about all events.
K: Keyspace events, published with the __keyspace@__ prefix
E: Keyevent events, published with __keyevent@__ prefix
g: Generic commands (non-type specific) such as DEL, EXPIRE, and 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.
Note that the parameter value must contain either K or E.
"" slowlog-log-slower-than The maximum amount of time allowed, in microseconds, for command execution. If this threshold is exceeded, Redis Slow Log will record the command. 0-1,000,000 10,000 slowlog-max-len The maximum allowed length of the Redis Slow Log logs. Slow Log consumes memory, but you can reclaim this memory by running the SLOWLOG RESET command. 0-1,000 128 Note
- For more information about Redis-specific parameters, visit https://redis.io/topics/memory-optimization.
- The latency-monitor-threshold parameter is usually used for fault location. After locating faults based on the latency information collected, change the value of latency-monitor-threshold to 0 to avoid unnecessary latency.
After you have finished setting parameters, click Save.
Click Yes to confirm.