Memcached服务器的运行状态监控一般可以用个专门的运营系统监控起来,不过一般开发者可以用memcached协议支持的统计命令(stats)在linux下直接得到。
1、使用telnet连接memcached服务器
telnet 10.10.10.10 11211
2、memcached统计命令
一些常用的统计信息或者配置信息可以通过stats命令来得到。完成步骤1连接到memcached服务器之后进入telnet命令行并输入stats,回车之后就可以得到这些统计信息了。这些统计信息包含的信息如下:
pid: Process id of this server process(memcached服务器的进程号)
uptime: Number of secs since the server started(memcache服务器运行时间,单位秒)
time:current UNIX time according to the server(memcached服务所在机器的时间,单位秒)
version:Version string of this server(当前memcached的版本号)
pointer_size:Default size of pointers on the host OS (generally 32 or 64)(默认指针地址长度,根据操作系统,该值可以为32或者64)
rusage_user: Accumulated user time for this process(seconds:microseconds)(累计用户使用时间,精确到毫秒)
rusage_system: Accumulated system time for this process (seconds:microseconds)(累计系统使用时间,精确到毫秒)
curr_items :Current number of items stored(当前存储的数据项个数)
total_items :Total number of items stored since the server started(自启动之后,此服务器存储过的数据项个数)
bytes:Current number of bytes used to store items(memcached服务器当前占用的内存,单位字节)
curr_connections:Number of open connections(当前打开的连接数)
total_connections :Total number of connections opened since the server started running(自启动之后,此服务器打开过的连接数)
connection_structures :Number of connection structures allocated by the server(此服务器分配的连接结构)
cmd_get :Cumulative number of retrieval reqs(获取请求数)
cmd_set:Cumulative number of storage reqs(存储请求数)
get_hits:Number of keys that have been requested and found present(请求成功的key的个数,缓存命中率=get_hits / cmd_get * 100% )
get_misses:Number of items that have been requested and not found(请求失败的key的个数)
delete_misses:Number of deletions reqs for missing keys(删除数据请求不命中key的个数)
delete_hits:Number of deletion reqs resulting in an item being removed.(删除数据请求命中key的个数)
incr_misses :Number of incr reqs against missing keys.
incr_hits: Number of successful incr reqs.
decr_misses:Number of decr reqs against missing keys.
decr_hits :Number of successful decr reqs.
cas_misses:Number of CAS reqs against missing keys.
cas_hits :Number of successful CAS reqs.
cas_badval: Number of CAS reqs for which a key was found, but the CAS value did not match.
auth_cmds: Number of authentication commands handled, success or failure.
auth_errors:Number of failed authentications.
evictions:Number of valid items removed from cache to free memory for new items
reclaimed:Number of times an entry was stored using memory from an expired entry(在已过期的数据占用的空间中存储新数据数据的次数, memcached优先使用过期数据占用的空间)
bytes_read : Total number of bytes read by this server from network(总共存储的字节数)
bytes_written:Total number of bytes sent by this server to network(中共发送的字节数)
limit_maxbytes: Number of bytes this server is allowed to use for storage.
threads :Number of worker threads requested. (see doc/threads.txt)
conn_yields: Number of times any connection yielded to another due to hitting the -R limit.