2

because something unexpected accidents redis memory has increased up a lot , and we delete the unused keys a lot , but the memory does not release, is there a way to manually release it, except restart of redis.

redis info

# Memory
used_memory:14166381000
used_memory_human:13.19G
used_memory_rss:41278218240
used_memory_peak:50044293760
used_memory_peak_human:46.61G
used_memory_lua:31744
mem_fragmentation_ratio:2.91
mem_allocator:jemalloc-3.2.0

nmon t



│ Top Processes Procs=288 mode=3 (1=Basic, 3=Perf 4=Size 5=I/O)──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│  PID       %CPU    Size     Res    Res     Res     Res    Shared    Faults  Command                                                                                                │
│             Used      KB     Set    Text    Data     Lib    KB     Min   Maj                                                                                                       │
│     1732    15.9 58932952 40309580     756 58921404       0   944      9      0 redis-server   


free -m
             total       used       free     shared    buffers     cached
Mem:         64378      61914       2464          0         11         22
-/+ buffers/cache:      61879       2498
Swap:        32255      16710      15545

2
  • Peak means "the greatest amount of memory that was used in the past". The "used" figures indicate how much is actually used. The peak number will never go down.
    – hobbs
    Jun 18, 2014 at 4:00
  • yes, I know redis peak memory mean, such as free -m and nmon was showing, the memory was eaten to much by redis , but in fact the data is far less as showing ,as you can see ,memory has been swapout already, so I hope there is a way to release some
    – mk_
    Jun 18, 2014 at 9:09

1 Answer 1

2

According to antirez https://groups.google.com/forum/#!topic/redis-db/ibhYDLT_n68 (1st answer) Redis would always use used_memory_peak as a reference to how much memory it might need (and how much memory it wants allocated).

If you really need to free that memory with zero downtime — you can setup a slave, make it read-write CONFIG SET slave-read-only no reroute your application traffic to the slave and restart the master. Or just continue using the slave (by making it master SLAVEOF NO ONE)

1
  • thanks for answer, the slave solution is we used yet, and have automated this thing through keepalived and shell, but the keepalived ,you know, there is a small problem that can cause a very short hang time, anyway ,i thinks i must belive there is no direct way to do this
    – mk_
    Jun 19, 2014 at 2:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.