memcached stats命令详解

然后你可以看见很多内容,具体可以参考:《 memcacche stats

以下是引用片段:

pid = process id
uptime = number of seconds since the process was started
time = current time
version = memcached version
rusage_user = seconds the cpu has devoted to the process as the user
rusage_system = seconds the cpu has devoted to the process as the system
curr_items = total number of items currently in memcache
total_items = total number of items that have passed through the cache
bytes = total number of bytes currently in use by curr_items
curr_connections = total number of open connections to memcached
connection_structures = ???
cmd_get = total GET commands issued to the server
cmd_set = total SET commands issued to the server
get_hits = total number of times a GET command was able to retrieve and
return data
get_misses = total number of times a GET command was unable to retrieve and
return data
bytes_read = total number of bytes input into the server
bytes_written = total number of bytes written by the server
limit_maxbytes = total storage bytes available to the server.

    着重说一下几个对观测很有用的项。

    limit_maxbytes、bytes

    memcached在存储的时候是可以设置失效时间的,但如果存储已经满了,那旧数据即使没有到过期时间,也会被移除。所以需要观察memcached存储是否已经满了,同时这对扩容也是有意义的参考。limit_maxbytes即总的存储大小,而bytes就是已经使用的大小,从这两个数据就可以看出在memcached启动时,我们为它分配的内存是否足够使用。

    cmd_get、cmd_set

    memcached启动后,我们对它一共做了多少次读取操作呢?从这两个参数可以观察出来。

    get_hits、get_misses

    使用memcached后,我们需要评估我们使用的策略是否合理。不能够使用中间缓存后,后端的数据库还是有较大的访问量,这样的话中间缓存就变得没有意义了。get_hits表示命中了多少次读取,即来memcached取到了多少有效数据;get_misses表示没有命中的次数,即此次来取数据的时候,memcached并没有你所查询的数据。如果没有清零统计数据的话,cmd_get = get_hits + get_misses。

    memcached 的状态查询还有其它的命令,可以参考:《Memcached的stats命令

    如下:

stats reset
清空统计数据

stats malloc
显示内存分配数据

stats maps
这个不太确定,看源代码是把/proc/self/maps的数据显示出来。

stats cachedump slab_id limit_num
显示某个slab中的前limit_num个key列表,显示格式如下
ITEM key_name [ value_length b; expire_time|access_time s]
其中,memcached 1.2.2及以前版本显示的是  访问时间(timestamp)
1.2.4以上版本,包括1.2.4显示 过期时间(timestamp)
如果是永不过期的key,expire_time会显示为服务器启动的时间

stats cachedump 7 2
ITEM copy_test1 [250 b; 1207795754 s]
ITEM copy_test [248 b; 1207793649 s]

stats slabs
显示各个slab的信息,包括chunk的大小、数目、使用情况等

stats items
显示各个slab中item的数目和最老item的年龄(最后一次访问距离现在的秒数)

stats detail [on|off|dump]
设置或者显示详细操作记录

参数为on,打开详细操作记录
参数为off,关闭详细操作记录
参数为dump,显示详细操作记录(每一个键值get、set、hit、del的次数)

stats detail dump
PREFIX copy_test2 get 1 hit 1 set 0 del 0
PREFIX copy_test1 get 1 hit 1 set 0 del 0
PREFIX cpy get 1 hit 0 set 0 del 0


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值