NOTE
5.4 Redis Memory Optimization
Redis memory-optimization notes on compact encodings, 32-bit instances, and maxmemory configuration.
This is a historical learning note and may contain outdated or incomplete understanding.
1. Underlying Encoding of Aggregate Data Types
When hash, list, and set consist only of integers, and when the number of zset elements is below a certain value, special encodings are used. This can be configured in redis.conf.
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
set-max-intset-entries 512
2. Use a 32-Bit Instance
Redis compiled on a 32-bit machine uses less memory than on 64-bit, and a 32-bit instance can run on a 64-bit machine.
3. Configure Maximum Memory
Configure maxmemory and maxmemory-policy in redis.conf.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub