Redis used_memory grows too fast than normal. After restart goes back to normal usage

87 views
Skip to first unread message

Sundaramurthy K

unread,
Feb 19, 2015, 7:29:25 AM2/19/15
to redi...@googlegroups.com
Hi, 

We are running Redis 2.2 on Ubuntu. Actual data in Redis is 5.56GB. dump.rdb's size is 3.5GB. At some point, the memory (used_memory_human) started growing too fast than normal. But after restarted the memory usage came back down to 5.56GB (Before restart, did a BGSAVE). Our usual increase per day is about 0.05GB. But during the issue, it has grown upto 13G (max) in 3 hours. 

We tried to reproduce the scenario and it seems when "keys test*" command is executed, this happens. We understand that using "KEYS" in production is recommended. But is this the expected impact of using "KEYS" command? 

Would like to make sure that this (KEYS) is the one that's causing the issues and eliminate it or to understand what else could be causing this behaviour. 

Any help is appreciated. Thanks

Josiah Carlson

unread,
Feb 19, 2015, 11:04:40 AM2/19/15
to redi...@googlegroups.com
Redis 2.2 is really old. You should upgrade to the most recent Redis 2.8 revision as soon as you can, or maybe wait a bit for Redis 3.0 to come out (hard to say the exact date this will happen).

Also, you may have forgotten a word, but KEYS is *not* recommended for use in production.

In terms of what is actually causing your issue, if using KEYS is increasing your memory usage, you shouldn't use it. But in Redis 2.8, the SCAN command lets you perform the equivalent of KEYS piece by piece, which should prevent memory usage spikes as you are experiencing.

And in terms of implementation on your side of things, typically the use of KEYS as part of an application signals that there is some missing piece that could be used instead, which could/would eliminate KEYS usage. This isn't always the case, but it has been the case 9 out of 10 times in posts I have seen here.

 - Josiah


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages