Why does Redis set maxmemory?

set it. If you exceed it, you will OOM. You might as well not set it at all.

Jul.08,2022

wait to be dropped by the system kill without setting?


Redis cache is not data storage, Redis cache is to avoid a large number of data reading and writing falling on the hard disk and caching hot data, so data applications that are not available on redis should be read on disk. Setting the maximum memory has two advantages: one is to avoid crashing when system resources are exhausted, but too much memory will inevitably affect efficiency such as memory management.

in addition, the maximum memory is set, and when the data you want to cache is larger than the maximum memory, it will not cause OOM,Redis to eliminate data that he does not think will be a hot spot according to the elimination algorithm.


the maximum memory setting is more considered as a cache scenario, that is, limit the maximum cache
should be used with policies, such as discarding data according to various policies after the limit is exceeded, or default kill
reference here


it is better to limit

.
Menu