命令:
[root@ct5 ~]# printf 'stats\r\n' | nc 127.0.0.1 11211
用linux类似top命令的方式查看memcached缓存信息:
[root@ct5 ~]# watch "printf 'stats\r\n' | nc 127.0.0.1 11212"
注意,首先服务器应该有nc命令
pid memcache服务器的进程ID
uptime 服务器已经运行的秒数
time 服务器当前的UNIX时间
version memcache版本
pointer_size 当前操作系统的指针大小(32位系统一般是32bit)
rusage_user 该进程累计的用户时间(秒:微妙)
rusage_system 该进程累计的系统时间(秒:微妙)
curr_connections 当前打开着的连接数量
total_connections 服务器运行以来接受的连接总数
cmd_get get命令(获取)总请求次数
cmd_set set命令(保存)总请求次数
cmd_flush flush命令次数
get_hits 请求成功的总次数
get_misses 请求失败的总次数
STAT delete_hits delete命中次数
delete_misses delete未命中次数
incr_misses incr未命中次数
incr_hits incr命中次数
decr_misses decr未命中次数
decr_hits decr命中次数
cas_misses cas未命中次数
cas_hits cas命中次数
cas_badval 使用擦拭次数
bytes_read 读取字节总数
bytes_written 写入字节总数
limit_maxbytes 分配的内存数(字节)
accepting_conns 目前接受的链接数
listen_disabled_num
threads 线程数
conn_yields
bytes 存储item字节数
curr_items item个数
total_items item总数
evictions 为获取空闲内存而删除的items数(分配给memcache的空间用满后需要删除旧的items来得到空间分配给新的items)
注:
cmd_get/uptime 结果是平均每秒请求缓存的次数——结果值越大,说明Memcached的利用率越高,站点的访问量大!
get_hits:是缓存命中的次数。命中率 = get_hits/cmd_get * 100%。
get_misses:是缓存未命中的次数。get_misses加上get_hits就等于cmd_get。
参考文章:http://blog.sina.com.cn/s/blog_7d31bbee010193il.html