Hi Josiah,
In this redis instance I have around 5M keys, almost all of them with a 10h TTL.
Let me see if I understood you properly. By default 10times/second (hz) redis will look for keys to expire. Does this mean that it will remove (and free memory) for ALL the already expired keys? Or it will just remove some of them?
I did a test yesterday. In that test I just had an instance (2.6.13) and I SETed thousands of keys. Half of them with a TTL of 30 and the other half with a TTL of 60.
The fisrt time I SET 12k keys everything seems fine. It works perfectly.
Then I SET 18k keys with a TTL of 5000, and start SETing thousands of the 30 and 60 TTL.
After the last set with TTL 60 finished I started looking the memory and the dbsize. As I understand it, theoretically 60 seconds after the last SET all keys would have to be expired (except for the 18k with TTL 5000) and so dbsize would have to be 18k. It doesn't happen like that. After 60 seconds (and after 300 seconds) dbsize is not yet 18k, it is "discounting" yes, so keys are being expired, deleted and memory is being freed, but much slower than what I was expecting knowing the 60 TTL (which would be all of them after 60s). The stranger thing yet is that, if in any moment after the 60s I do a "keys *" on the instance, memory is freed and dbsize is 18k (in fact there are 18k keys).
So, from my point of view this means that still if the redis process expiring keys (hz) is really deleting them, it is not deleting ALL the keys which are already expired. And somehow when I use "keys *" it really forces ALL expired keys to be deleted and memory freed.
Sorry for this extended explanation, but I think my first post was too vague and I am not sure if this is this behavior supposed to be normal.
Thanks a lot!