Blog

Getting Nostalgic about Memcached

Placeholder Avatar
Glenn Davy
March 22, 2013

Ever had the nagging sense that all that caching work you’ve just done, isn’t yielding the results you had hope for? Or perhaps you don’t seem to be getting the improvement you once did, or you see evidence in your logs that things are being cached, then further down, there’s data being generated prematurely?

How do you go about find out what is going on?

Well, you can start by reading the memcached text protocol, and then use what you’ve learned there to interrogate memcached using telnet or netcat or any tool you prefer. We’re going to use netcat, its pretty ubiquitous and simple for this purpose. We’re also going to assume you’re on the same box as the memcached instances that you’re interested in, and that its running on port 11211.

$echo stats|nc localhost 11211 STAT pid 29232 STAT uptime 13096670 STAT version 1.4.5 STAT cmd_get 16082428 STAT cmd_set 385658032 STAT cmd_flush 21 STAT get_hits 926923674 STAT get_misses 479158754 STAT bytes_read 13877916015974 STAT bytes_written 3063162027584 STAT limit_maxbytes 3460300800 STAT bytes 2787768823 STAT curr_items 57949 STAT total_items 385657951 STAT evictions 367643811 STAT reclaimed 14770696 END $