0

I know redis can be used as LRU cache, but is there softlimit flag, where we can state after specific criteria is reached "redis will start cleaning LRU items".

Actually I'm getting OOM errors on redis, I've set redis to LRU cache, but it hits OOM limit and application stops.

I know of "maxmemory " flag, but is there a softlimit, where we've some 10% space left, and we can start eviction of some items, so that application doesn't stop !

Sumit Murari
  • 1,597
  • 3
  • 28
  • 43

1 Answers1

1

Did you set a specific eviction policy?

See: Eviction policies http://redis.io/topics/lru-cache

I would then check, to make sure that you are not inadvertently setting PERSIST on your redis objects. PERSISTED objects, I believe, cannot be LRU'd out.

You can use http://redis.io/commands/ttl TTL to find out the time limit on your keys. And "Keys" to get a list of keys (this is dangerous on a production server, as the list could be very long and blocking). http://redis.io/commands/keys

-daniel

Daniel
  • 7,006
  • 7
  • 43
  • 49
  • Yup ..I've set eviction policy to : allkeys-lru, and was still getting memory-full OOM errors ! – Sumit Murari Sep 28 '15 at 08:27
  • Updated answer per your comment. – Daniel Sep 29 '15 at 14:17
  • Thnx @daniel ...I need to check this up, this might be the culprit ! – Sumit Murari Sep 29 '15 at 14:21
  • can you please confirm, maxmemory limit is the setting which once reached, no other key-value pairs will be added, and eviction will start, is there a way I can tell redis start eviction if memory>2gb , but it can continue putting objets inside , is read-write operation are at faster pace. Does single threaded model doesn't allow to do so ! – Sumit Murari Sep 29 '15 at 14:25
  • I believe that to be the functionality. If your are still running into memory problems you should audit what you are using redis for, if you have enough space ram, and if you should use a more compact memory method, such has hset, hget. You may be trying to store 4gb in 2gb and are just cycling though too much memory and you need to get more ram or go with a cluster. You can also try making sure redis is up to date – Daniel Sep 30 '15 at 15:43