Memcache监控工具 -- memkeys

简介:

介绍


memkeys是tumblr开源的类似top的工具,可用于实时查看memcached的key使用情况。

 

安装


安装autoconf(要求版本2.68以上):

1
2
3
4
5
# wget -c http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
# tar zxvf autoconf-latest.tar.gz
# cd autoconf-2.69
# ./configure
# make && make install

 

安装其它依赖:

1
# yum install libpcap-devel pcre-devel ncurses-devel

 

安装memkeys:

1
2
3
4
5
# git clone https://github.com/tumblr/memkeys.git
# cd memkeys
# ./autogen.sh
# ./configure
# make && make install

 

使用


1
# memkeys -h
1
2
3
4
5
6
7
8
9
10
Usage: memkeys -i NIC [options]
-d, --discard=THRESH Discard keys where req/s rate is below THRESH
-i, --interface=NIC Network interface to capture traffic on (required)
-p, --port=PORT Network port to capture memcache traffic on (default 11211)
-r, --refresh=INTERVAL Refresh the stats display every INTERVAL ms (default 500)
-l, --logfile=FILE Output logs to FILE
-R, --report=REPORT Output data in REPORT format (CSV or curses, default curses)
-h, --help This help
-v, --verbose Increase verbosity. May be used multiple times.
-V, --version Show program info and exit.

 

捕获eth0上memcached的key的使用情况,记录日志到/tmp/memkeys.log:

1
memkeys -i eth0 -l  /tmp/memkeys .log

 

显示结果类似如下:

1
2
3
4
5
6
memcache key calls objsize req/sec bw(kbps)
username 1 12 0.14 0.01
key12 1 6 0.07 0.00
key10 1 6 0.06 0.00
sort mode: reqrate (desc) keys: 3 packets (recv/dropped): 24 / 0 (0.00%) rt: 1 (ms)
B:sort by bandwidth | C:sort by calls | Q:quit | R:sort by req/sec | S:sort by size | T:toggle sort order (asc|desc)

 

当你在一个很大网络流量的机器上运行memkeys,需要定义一个每秒请求量的阈值,过滤掉req/sec小于指定的值,否则内存空间占用将会增长得相当大。

1
memkeys -i eth0 -d 10.0 -l  /tmp/memkeys .log














本文转自UltraSQL51CTO博客,原文链接:http://blog.51cto.com/ultrasql/1637555  ,如需转载请自行联系原作者

相关文章
|
监控 数据库 Memcache
如何搭建memcached?并使用Zabbix监控memcached?
一、 环境准备(这里是测试环境) zabbix-server.3.2.11 zabbix_agentd(centos7.0 二、 部署memcached 1、 什么是memcached? memcached是一套分布式的高速缓存系统,由LiveJournal的Brad Fitzpatrick开发,以BSD license授权发布。
1190 0
|
监控 Linux Memcache
|
监控 Memcache 对象存储