Reputation: 4996
Is there a way to set Redis so it will never evict data and cause a hard failure if it runs out of memory? I need to ensure no data is lost; I am not using this as a permanent data storage, mechanism, but rather for more of a temporary data storage mechanism for high volume/high performance data transformations.
Is there an alternative NoSQL data store that could come close in performance, but utilize disk read/write if memory runs out; this is not ideal, but is better than losing data. I am reading/writing/updating millions of JSON documents (12+ million and growing).
Upvotes: 0
Views: 156
Reputation: 50122
Yes.
First make sure that you set the maxmemory
directive (in the conf file or with a CONFIG SET
) to a value other than 0. This will instruct Redis to use that value as it's memory upper limit.
Next, set the maxmemory-policy
directive to noeviction
- this will cause Redis to return an OOM (out of memory) error when maxmemory
is reached when trying to write to it.
See the config file in-file documentation for more details on these directives: http://download.redis.io/redis-stable/redis.conf
Upvotes: 1