What is the best way to monitor memcached
from a Java application on a Linux machine? I would like information such as:
1) Memory used by each object
2) Number of items evicted for reclaiming memory
3) etc..
I know this question is old:
But for some quick monitoring of a running memcached system: ( in ubuntu )
$ sudo apt-get install libmemcached-tools
This includes a handful of handy tools. The one in particular that I use is memcstat
$ watch -n1 -d 'memcstat --servers localhost'
This will show alot of handy information like for instance:
curr_connections: 5
total_connections: 26
get_hits: 202
get_misses: 12
bytes_read: 1650
bytes_written: 74345
This is handy because it does not require you to write a single line of code, and better yet will tell you if your caching infrastructure is working like you expect it too.
Here is some information on memcached monitoring and another list.
Memcached from Java is a bit of an odd choice though. I'm curious why you chose it. Caching solutions on Java tend to revolve around, say, EHCache or Terracotta. Here is a more complete list of Java caching solutions.