We are expiring 1000 keys per sec by average while taking snapshot we happened to see the size of the dump is comparatively lesser than the primary since because the snapshot is excluding the expired key's memory. Since expiring keys holding much memory in our platform, is there any way that we can make redis to release the memory held for expired keys periodically. (we are using 2.8.21 engine) or latest redis engine versions will resolve this problem little efficiently. Please guide me to the correct platform if stackoverflow is not appropriate for my question.
Reclaim memory guide : https://docs.redislabs.com/latest/ri/memory-optimizations/reclaim-expired-keys-memory-faster/ ( but need suggestion, whether upgrading will help a lot or doing scan will be good as mentioned in the doc)
Expired keys are removed from memory:
SCAN
would help you, it forces a passive removal across all the keyspace. Upgrading may help as there new features/configuration settings, like activedefrag
.
Please see Redis filling up memory fast, running --bigkeys free it up for solutions including eviction policy and active expiring frequency.