Sometimes I like to write down posts like this, to remind myself how to do something, sort of a mental note.
Suppose you have a few application servers that use 1+ memcached servers, and you want some way to display the outbound traffic, providing some insights on what are the most used keys, counters, etc…
Here's a quick way to do that, assuming you're using the memcached text protocol:
tcpflow -ce dst port 11211 | cut -b53- | grep ^get | pipestat --clear --runtime 60 --field 2 --time 1 --limit 40
What this does is:
- Use tcpflow to capture all outbound traffic to destination port 11211, default memcached port.
- Remove the first 53 bytes from each line, to filter out source and destination ip/ports
- Only display get requests (alternatively, use
- Feed the resulting data to pipestat, a simple but great Perl tool that aggregates the data, displaying the most frequent ones. The specific options I used are good if you want to display quick statistics like other tools as
It goes without saying that these tools are automatically installed on all servers that our Devops team here at Opera manages. I couldn't work without them :)