Monday, January 10, 2011

Dumping stats from a memcached server...

I normally dump the stats from my memcached servers with the following command:

trond@opensolaris> echo stats | nc localhost 11211

But if you start memcached with the ascii protocol disabled it becomes hard to dump the stats. I just created a small tool named mcstats that dumps the stats in the same format as you would get from the above command.

trond@opensolaris> ./mcstat
STAT evictions 0
STAT curr_items 0
STAT total_items 0
STAT bytes 0
STAT reclaimed 0
STAT engine_maxbytes 67108864
STAT pid 15436
STAT uptime 682
STAT time 1294693339
STAT version 1.3.3_499_g580ae55
STAT libevent 1.4.13-stable
STAT pointer_size 32
STAT rusage_user 0.012261
STAT rusage_system 0.014169
STAT daemon_connections 10
STAT curr_connections 11
STAT total_connections 16
STAT connection_structures 14
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 0
STAT auth_cmds 0
STAT auth_errors 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT bytes_read 106
STAT bytes_written 5656
STAT limit_maxbytes 67108864
STAT rejected_conns 0
STAT threads 4
STAT conn_yields 0

By default mcstat will connect to "localhost:11211", but you may tell it to go somewhere else by using -h host.

You'll find the tool in my git branch of the memcached source repository

Happy new year btw.

No comments:

Post a Comment