mem_fragmentation_ratio:35.69 is too high

713 views
Skip to first unread message

unread,
Oct 25, 2011, 12:59:40 PM10/25/11
to redi...@googlegroups.com
how to compact memory use online ?

1,redis> info
redis_version:2.2.7
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:64
multiplexing_api:epoll
process_id:17398
uptime_in_seconds:2760805
uptime_in_days:31
lru_clock:1932587
used_cpu_sys:51204.61
used_cpu_user:37240.59
used_cpu_sys_childrens:49.15
used_cpu_user_childrens:6.70
connected_clients:4
connected_slaves:2
client_longest_output_list:14724
client_biggest_input_buf:0
blocked_clients:0

used_memory:381205072
used_memory_human:363.55M
used_memory_rss:13606113280
mem_fragmentation_ratio:35.69 ------>look this

use_tcmalloc:0
loading:0
aof_enabled:0
changes_since_last_save:2949614
bgsave_in_progress:0
last_save_time:1319556858
bgrewriteaof_in_progress:0
total_connections_received:1229080
total_commands_processed:2499964868
expired_keys:0
evicted_keys:0
keyspace_hits:1944122392
keyspace_misses:6834650
hash_max_zipmap_entries:512
hash_max_zipmap_value:64
pubsub_channels:0
pubsub_patterns:0
vm_enabled:0
role:master
allocation_stats:6=1,8=549528578,9=415700088,10=52186253,11=1085799,12=1788660,13=587319911,14=99476803,15=503209,16=7738171297,17=273801066,18=1836554141,19=205519405,20=3658782,21=769511826,22=90527858,23=776267412,24=2026833802,25=238111298,26=9,27=70180,28=10814636,29=8,30=7,31=756688,32=522465,33=8409,34=873549,35=266493,36=886849,37=206799,38=336127,39=299372,40=1365384,41=35191125,42=66943,43=1210052636,44=202,45=2828,46=24205529,47=7750,48=5064035,49=11201,50=4,51=31,52=194,53=9,54=2,55=5107,56=184,57=568043,58=27,59=6436,60=226,61=39,62=16,63=59,64=19350,65=3341,66=25147,67=231108,68=1567346,69=5431309,70=11555326,71=13548143,72=8845410,73=6779992,74=12163021,75=12924023,76=6706897,77=472183,78=571113,79=309386,80=149,81=3379,82=22,83=1795,84=155,85=47,86=17,87=6849,88=1254287,89=4272,90=5,91=666,92=123,93=1772,94=2,95=581,96=122,97=2057,98=2,99=3,100=119,101=1647,102=2,103=235,104=114,105=195,106=2,107=3249,108=111,109=566042,110=2,111=363,112=111,113=24,114=2,115=36816,116=107,117=113,118=2,119=12,120=102,121=575,122=1,123=79,124=100,125=1134,126=1,127=1277,128=18123,129=123,130=1,131=3851,132=132,133=12503,134=701,135=52242,136=5196,137=147123,138=11709,139=36168,140=7283,141=21228,142=2078,143=54387,144=100,145=43538,146=1,147=7525,148=100,149=2562,150=1,151=1324,152=100,153=249,154=1,155=20,156=100,157=33,158=1,159=9,160=100,161=75,162=1,163=1,164=99,165=1,167=3465,168=99,169=32,171=43695,172=99,173=69604,175=36,176=99,177=377,179=47528,180=99,181=1909,183=1693,184=99,185=605,187=422,188=99,189=23,191=30,192=99,193=27,195=42,196=122,197=106,198=219,199=443,200=791,201=992,202=1038,203=964,204=774,205=1853,206=268,207=3332,208=174,209=49,210=21,211=34,212=106,213=3614,215=48,216=99,217=562173,219=34,220=99,221=47,223=3037,224=99,225=1205,227=212,228=99,229=12,231=7,232=99,233=32,236=100,237=6,239=4,240=100,241=17,243=473,244=100,245=2,247=5,248=100,249=6,251=28,252=100,253=1,255=10,>=256=2616035
db0:keys=8858,expires=0


2, use top cmd:
17398 root 15 0 12.7g 12g 648 S 2.0 53.8 1474:32
redis-server
--
---------------------------------------------------------------------
Keep Smiling!

Didier Spezia

unread,
Oct 25, 2011, 1:09:32 PM10/25/11
to redi...@googlegroups.com

You cannot.

If you have enough memory on the machine, you can try to create a slave,
move your application to point to the slave, then drop the master.
This procedure is described here: http://redis.io/topics/admin

If you are running Redis on Linux, fragmentation is much lower with the 2.4
version (thanks to jemalloc). If you want to stick to 2.2, then compiling Redis
against tcmalloc may also help.

Regards,
Didier.

Pieter Noordhuis

unread,
Oct 25, 2011, 1:22:13 PM10/25/11
to redi...@googlegroups.com
The "client_longest_output_list" field in your INFO output is
particularly high. This is likely to be caused by clients that
pipeline a lot of commands to Redis and are unable to consume the
replies fast enough. The replies are buffered in memory, which in turn
can cause a big spike/burst in memory usage. The default memory
allocator in 2.2 (libc malloc) is not that good in giving memory back
to the OS, which is why you see the high fragmentation ratio. Next to
moving to 2.4 for its allocator (jemalloc appears to be lots better at
this type of memory management), you might want to look at your
clients and see if you can throttle the commands they're sending.

Cheers,
Pieter

> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
>
>

unread,
Oct 26, 2011, 5:32:57 AM10/26/11
to redi...@googlegroups.com
Thanks.I used a slave to replace the original and modified my client
programe.It works well.


--
---------------------------------------------------------------------
Keep Smiling!

Reply all
Reply to author
Forward
0 new messages