How does Max Memory Policy works ?

Skip to first unread message

Ankit Gupta

Aug 18, 2021, 3:42:31 AMAug 18
to Redis DB
Hi Experts,

For testing purpose I have set the maxmemory : 2gb , maxmemory-policy : volatile-lru.

 I am inserting plain data with expiry ranging between 1-50000 seconds and can see that with this configuration the max memory never crosses 2gb and the system is able to insert the new data and is kind of deleting the least recently used data. 

I have changed the loglevel to debug, still I am unable to find any logs related to `maxmemory-policy` start/end.

I wanted to know , how do I find below :
1. When did maxmemory-policy(volatile-lru in present) got triggered?
2. How many keys were deleted by maxmemory-policy(volatile-lru in present)
3. What were the ttl of deleted keys ?
4. How much time did maxmemory-policy(volatile-lru in present) process took?
5. If triggered/started does the maxmemory-policy(volatile-lru in present) process deletes all the keys for which expiry is set ?

Can you please point me to any article explaining inner working of redis volatile-lru .


Ankit Gupta

Aug 18, 2021, 7:00:46 AMAug 18
to Redis DB
1. Is there any setting/configuration/workaround by which we can set min memory so that when lru get's triggered than it only deletes/clean data upto certain threshold.
2. If above is possible then will there be any downsides of using such config?

Kunal Gangakhedkar

Aug 18, 2021, 9:13:56 AMAug 18
All details about LRU mechanism are documented here:


You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages