Skip to content

Redis master evicts all keys when reaching memory limit #4213

@joshuawscott

Description

@joshuawscott

Hello,

I have a few master-slave setups where we have a master redis that receives all the writes, and replicates to between 3 and 19 slaves that receive only reads. We set expirations on all keys, and have a maxmemory limit of 16gb with a maxmemory-policy of volatile-ttl.

I'm experiencing an issue where when the master redis reaches the maxmemory limit, it begins evicting keys (as expected), but evicts all the keys in the database. The keys are URLs, and the values are short strings; we have roughly 66 million keys in the database when the maxmemory limit is reached. We are seeing this in at least 8 different redis replication setups where we are reaching maxmemory and having this eviction problem. All have a 16gb or higher maxmemory limit.

The other related symptom is that once the master evicts all the keys, some of the slaves do not delete their keys and still have e.g. 65 million keys after finishing a sync with a master that has less than 200 thousand.

The gist linked below has logs for master (master.log), the slave that failed to re-sync properly (bad_slave.log) and the slave that did re-sync properly (good_slave.log). Logs were gathered at the verbose level.

Info:

$ uname -a
Linux <servername> 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ redis-server -v
Redis server v=4.0.1 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=59320dbc052344f

Master/slave configs and logs from the time when this occurred are at:
https://gist.github.com/joshuawscott/f9e238aff68417292d6d8d107409d071

Please let me know if there's any other info you need to help get to the bottom of this issue

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions