Redis BigKey
TOC
Introduction to BigKey
In Redis, BigKeys consume excessive memory resources, which affects the performance and availability of Redis.
Generally speaking, the following conditions may cause a key to be considered a BigKey:
- For string type keys, if the allocated memory exceeds 5 MB.
- For list type keys, if the number of elements exceeds 20,000, or the allocated memory exceeds 1 MB.
- For set type keys, if the number of elements exceeds 5,000, or the allocated memory exceeds 1 MB.
- For sorted set type keys, if the number of elements exceeds 10,000, or the allocated memory exceeds 1 MB.
- For hash type keys, if the number of fields exceeds 1,000, or the allocated memory exceeds 1 MB.
Note: These thresholds are not rigid rules and should be judged based on your actual situation to determine whether a key qualifies as a BigKey.
How to identify BigKeys in a Redis instance?
Use the following command to sample and check the keys in Redis, identifying those that occupy a large amount of memory, along with their types and sizes.
For more detailed methods of detecting BigKeys, refer to .