Monday, January 11, 2010

Monitor Memcached status

It is quite a important task to manage and monitor the memcache caching system. There are quite a lot of options to carry out this operation.

1. Using Telnet Command Line interface

List of supported commands are available at

http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt



telnet localhost 11211



List of keys used

stats items


STAT items:5:number 2
STAT items:5:age 47
STAT items:5:evicted 0
STAT items:5:evicted_nonzero 0
STAT items:5:evicted_time 0
STAT items:5:outofmemory 0
STAT items:5:tailrepairs 0
END



2. Using memcached-tool

The memcached tool is available in the source directory .

/usr/src/memcached-1.4.4/scripts/memcached-tool

Stats

/usr/src/memcached-1.4.4/scripts/memcached-tool 127.0.0.1:11211 stats

Show slab information

/usr/src/memcached-1.4.4/scripts/memcached-tool 127.0.0.1:11211 display

Show keys and values

/usr/src/memcached-1.4.4/scripts/memcached-tool 127.0.0.1:11211 dump


3. Using the damemtop

A flexible 'top' like utility for viewing memcached clusters. You can use it to manage a interactive cluster status.

The utility is available in the source directory. /usr/src/memcached-1.4.4/scripts/damemtop


It require you to install the following perl modules

cpan AnyEvent Term::ReadKey YAML


Now you need the /etc/damemtop.yaml file with the following contents.


delay: 3
mode: t
top_mode:
sort_column: "hostname"
sort_order: "asc"
columns:
- hostname
- all_version
- all_fill_rate
- hit_rate
- evictions
- bytes_written
- "2:get_hits"
servers:
- 127.0.01:11211


In a distributed environment you can add all the servers in the cluster to the file and issue the following command.


/usr/src/memcached-1.4.4/scripts/damemtop


That would give you a ideal monitoring setup..

1 comment: