18

Is there any command line or php script which returns the memcached total memory usage?

33

As Mike said, you can look at the line including the "STAT bytes" to see memory usage:

$ echo "stats" | nc -w 1 <host> <port> | awk '$2 == "bytes" { print $2" "$3 }'
  • Leaving that for future reference: The default host/port is: 127.0.0.1:11211 – Moritur Feb 8 '17 at 12:25
19

memcache's default port is 11211 so if memcache is local

telnet localhost 11211

Then run the stats command and that will spit out memory usage

stats
  • 1
    Thanks for the telnet tip, but what should I really read in there? I see STAT bytes 9857275 STAT curr_items 43599 STAT total_items 1048925 and I have the impression that my memcached is never filling up... – Stefano Dec 6 '11 at 22:13
  • 6
    STAT bytes is the line you are looking for total usage – Mike Dec 7 '11 at 2:19
4

I personally use PhpMemcacheAdmin

http://code.google.com/p/phpmemcacheadmin/

It creates an easy to use GUI. Of course you'll need to have PHP support.

0

Another alternative to answer @mike,

echo "stats" | nc localhost 11211
#or
echo "stats settings" | nc localhost 11211

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.