Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a database based key eviction policy in redis when RAM is full

Tags:

redis

lru

evict

I am using 5 databases in my redis server. I want to evict keys belonging to a particular DB using LRU mechanism. Is it possible ?

I read this: how-to-make-redis-choose-lru-eviction-policy-for-only-some-of-the-keys.

But all my databases are using time to live for their entries. So cant use volatile-lru policy.

I tried volatile-ttl policy but other databases are having less ttl for their keys. So they will get evicted which I dont want.

like image 806
revs Avatar asked Sep 27 '22 10:09

revs


1 Answers

That's one of the effects of using numbered/shared database - they all share the same configuration and resources. You should consider using separate Redis servers, one for each of your databases, to have better control over what gets evicted and when. Even more importantly, using dedicated instances allows you to better utilize the cores that you server has.

like image 112
Itamar Haber Avatar answered Sep 30 '22 07:09

Itamar Haber