如何判断你的memcache需要加大
2009年05月11日 作者: 大头刚
从系统状态和memcache状态2方面看:
vmstat 1 procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 0 0 11084 43932 108216 231052 0 0 0 126 0 0 26 1 73 0 1 0 11084 43932 108216 231052 0 0 0 0 17275 22948 1 7 91 0 0 0 11084 43932 108216 231052 0 0 0 0 17599 25425 1 8 91 0 2 0 11084 43932 108216 231052 0 0 0 0 17010 31904 1 10 89 0 0 0 11084 43996 108216 231052 0 0 0 0 16966 23137 1 7 92 0 0 0 11084 43996 108220 231048 0 0 0 44 17515 24955 1 7 92 0 0 0 11084 43996 108220 231048 0 0 0 0 17072 23630 1 7 91 0 0 0 11084 43996 108220 231048 0 0 0 0 17112 23915 1 7 92 0
in 在某一时间间隔中观测到的每秒系统调用次数。
cs 在某一时间间隔中观测到的每秒钟上下文切换次数。
ifstat
eth0 eth1 bond0
KB/s in KB/s out KB/s in KB/s out KB/s in KB/s out
39452.35 14656.75 0.37 0.00 39452.73 14656.75
44789.97 13518.02 0.06 0.00 44790.03 13518.02
22698.28 12429.86 0.06 0.00 22698.34 12429.86
32490.77 15708.73 0.13 0.00 32490.90 15708.73
39068.06 15235.64 0.06 0.00 39068.12 15235.64从上面的监控可以看出,系统的调用和上下文切换都非常的频繁,并且网卡的流量也很大。继续查看memcaced的状态
telnet localhost 11211 Trying Connected to Escape character is '^]'. stats STAT pid 22522 STAT uptime 276930 STAT time 1238401265 STAT version 1.2.6 STAT pointer_size 64 STAT rusage_user 10034.258560 STAT rusage_system 42350.882687 STAT curr_items 27912547 STAT total_items 754753663 STAT bytes 10707420267 STAT curr_connections 305 STAT total_connections 196514743 STAT connection_structures 13111 STAT cmd_get 1027276249 STAT cmd_set 754753741 STAT get_hits 925933089 STAT get_misses 101343160 STAT evictions 691211 STAT bytes_read 7003296080141 STAT bytes_written 2915427902797 STAT limit_maxbytes 15728640000 STAT threads 4 END
evictions的值很高,表示MEMCACHE需要更多的空间来存放新的数据。
也可是使用工具来查看
perl test_memcached.pl localhost:11211 # Item_Size Max_age 1MB_pages Count Full? 1 128 B 244145 s 1448 11862015 yes 2 256 B 242518 s 1276 5226444 yes 3 512 B 234294 s 1372 2809685 yes 4 1.0 kB 240542 s 6697 6857722 yes 5 2.0 kB 232060 s 343 175506 yes 6 4.0 kB 245608 s 3833 981134 yes 7 8.0 kB 276262 s 17 652 no 8 16.0 kB 191523 s 7 54 no 9 32.0 kB 237854 s 1 6 no 10 64.0 kB 61 s 1 4 no 11 128.0 kB 0 s 2 0 no 12 256.0 kB 191523 s 2 1 no 13 512.0 kB 0 s 1 0 no
这种情况,说明你需要增加你的memcache服务器了,或者从应该下手,修改程序。
Leave a Reply.




流浪猫 1F
08月 20th, 2009 at 17:46
maatkit总结的真好