I had stragne statistics on one memcached servers. I had to look what it’s doing there. I found such commands that may be used to sniff, extract and make statistics from running memcached server.

Debug GET commands

tcpflow -c dst port 11211 | cut -b46- | grep ^get

cut command will remove 46 bytes at beginning of every string (src, dst, port). You may need to adjust numeric parameter for cut to leave commands only. Output should look like:

get myapp-cache-theme_registry
get myapp-cache_field
get myapp-cache-schema
...

Debug everything except GET commands

tcpflow -c dst port 11211 | cut -b46- | grep -v ^get

Check transfer

Add pv -r at the end to calculate transfer:

$ tcpflow -c dst port 11211 | cut -b46- | grep ^get | pv -r > /dev/null
tcpflow[11140]: listening on eth0
[8.25kB/s]

Check command rates

To check command rates not the transfer add -l param (stands for lines) to pv command:

$ tcpflow -c dst port 11211 | cut -b46- | grep -v ^get | pv -rl > /dev/null
tcpflow[9271]: listening on eth0
[1.51k/s]

That should be enough for you to start debugging 😄

Source:
http://www.streppone.it/cosimo/blog/tag/memcached/external link