Memory growth on Redis server

Re: 回應: Re: Memory growth on Redis server

by Alex Rowe -
Number of replies: 1
If you don't set a maxmemory limit the allkeys-lru policy then isn't really going to be used as it will never need to evict any keys.

Here is what happens to Redis when it runs out of memory (https://redis.io/topics/faq):
Redis will either be killed by the Linux kernel OOM killer, crash with an error, or will start to slow down. With modern operating systems malloc() returning NULL is not common, usually the server will start swapping (if some swap space is configured), and Redis performance will start to degrade, so you'll probably notice there is something wrong.

Maxmemory sets the limit of how much RAM/memory Redis can use. If you have a 4GB system, something like 3GB may be a good value (but large for moodle for example).

Once it gets close to 3GB of data in Redis, it will then choose what to do by the maxmemory policy. Allkeys-lru will try to remove the least recently used key to make room for the newer keys.

If using a single redis instance with different prefixes for muc and sessions, it should be ok, but keep an eye on it when it's getting large to make sure it's not running into any issues.

Average of ratings: Useful (1)
In reply to Alex Rowe

回應: Re: 回應: Re: Memory growth on Redis server

by 丞浩 吳 -
Hi Alex,

Sorry for the late reply. Just want to give positive feedback.
We have adopted the setting you mentioned on our testing server.
The result was perfect and the memory usage decrease and maintain at the expected watermark.

We will adopt the changes to our production server during the winter break.
Hope it will also work perfectly.

Thanks again for your kindly help. smile