Command | Risk Description | Alternative |
HGETALL | Returns all fields of a hash at once, causing severe blocking when there are too many fields within the Key. | Use HSCAN cursor for batch traversal. |
SMEMBERS | Returns all members of a set at once. | Use SSCAN cursor for batch traversal. |
ZRANGE | Returns all members of a specified range in a sorted set at once. | Use ZSCAN cursor for batch traversal or narrow the query scope. |
LRANGE | Returns all elements of a specified range in a list at once. | Narrow the scope or obtain data in pages. |
SINTER | Performing intersection on multiple sets, with execution time increasing as the number of elements grows. | Perform intersection operations on the application side. |
disable-command-list parameter.Command | Risk Description | Alternative |
KEYS | Scans all keys matching a pattern, blocking the Redis server. | Use SCAN cursor for progressive matching. |
FLUSHDB | Empties all data in the current database, with no possibility of restoration. | Perform progressive deletion via SCAN + DEL |
FLUSHALL | Empties all data in all databases of the instance, with no possibility of restoration. | Perform progressive deletion via SCAN + DEL |
SHUTDOWN | Shuts down the Redis server, causing service interruption and data loss. | Manage the instance lifecycle via the console. |
CONFIG | Modifies the runtime configuration of the server, and improper operation may cause a crash. | Modify instance parameters via the console. |
Command | Risk Description | Usage recommendations |
RANDOMKEY | Randomly returns a key and blocks the Redis server. | Use only in test environments. |
INFO | Returns server statistics and blocks other requests during execution. | Use only for short periods during troubleshooting. |
BGREWRITEAOF | Asynchronously rewrites the AOF file and consumes a large amount of system resources. | Triggered automatically by the system. Avoid manual execution. |
BGSAVE | Asynchronously generates an RDB snapshot and consumes a large amount of system resources. | Triggered automatically by the system. Avoid manual execution. |
SELECT command.Architecture | Usage recommendations |
Standard Edition | Data can be isolated using Multi-DB, but since Redis is single-threaded, requests across different DBs may interfere with each other. |
Cluster Edition | It is recommended to prioritize using DB 0. Non-0 DBs do not support capacity expansion. |
SELECT 0 to reduce unnecessary network interactions.Method | Description | Application scenarios |
Native Batch Commands ( MGET/MSET) | Atomic operation, executed by the server in a single batch. | Batch read and write operations on keys of the same type |
Pipeline | Non-atomic operation, where the client packages and sends multiple commands. | Batch execution of commands of different types |
MGET key1 key2 key3 ... key1000
# First BatchMGET key1 key2 ... key500# Second BatchMGET key501 key502 ... key800
redis.call / redis.pcall, the Key positions must come from the KEYS array. Otherwise, an error is returned:-ERR bad lua script for redis cluster, all the keys that the script uses should be passed using the KEYS array
Lua script attempted to access a non local key in a cluster node
Scenario | Usage recommendations |
Daily operation | Do not enable Monitor. |
Issue Troubleshooting | You can enable it for a short period to analyze command execution. Disable it promptly after troubleshooting. |
Risk Type | Description |
Data Skew (Memory Skew) | Keys that heavily use the same Hashtag gather on a single node, causing memory utilization on that node to be significantly higher than on other nodes, which may prematurely trigger a memory alarm or cause it to become full. |
Request Skew (Hotspot) | All read and write requests targeting these keys hit the same node, making it a performance bottleneck, which leads to increased latency and may even bring down the entire cluster. |
Non-Scalability | Hash slot calculation relies on a fixed Hashtag, and the resulting skew issues cannot be mitigated by adding more nodes to the cluster. |
Guideline | Description |
Minimize and Split | Do not use a single, unified Hashtag for all related data. Instead, use different fine-grained hashtags based on business type or functional module. |
Ensure Uniform Distribution. | Ensure Hashtag values are evenly distributed overall. You can append suffixes to the original ID for manual sharding. |
Use Only When Necessary. | Use Hashtags only when transactions, Lua scripts, or multi-key commands are required. Do not misuse this feature for unrelated keys. |
SET {global}:user:1001 "data1"SET {global}:user:1002 "data2"SET {global}:order:5001 "order_data"
SET {user:1001}:profile "data1"SET {user:1001}:session "session_data"SET {order:5001}:detail "order_data"
Limit | Description |
Message Persistence | Redis Pub/Sub does not persist messages, and messages during consumer offline periods will be lost. |
Message Acknowledgment | Does not support the consumption acknowledgment mechanism (ACK), and cannot guarantee that messages are reliably consumed. |
Backlog Capacity | When the List structure is used as a queue, message backlog can consume a large amount of memory, affecting cache performance. |
Consumption Model | Does not support advanced features such as consumer groups and message partitioning. |
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários