2

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..

Matt J
  • 43,589
  • 7
  • 49
  • 57
Java Guy
  • 3,391
  • 14
  • 49
  • 55

2 Answers2

3

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.

Jeff Sheffield
  • 5,768
  • 3
  • 25
  • 32
1

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.

Community
  • 1
  • 1
cletus
  • 616,129
  • 168
  • 910
  • 942
  • 1
    Is there anything about the Java client that makes you say it's an "odd choice" other than it not being a common choice? Also, from the question, it's not clear if the application(s) using memcached are Java-based, or if he just wants the monitoring to be – matt b Apr 08 '09 at 23:49
  • Also also, using memcached as a caching solution would enable other clients on other platforms to interact with the cached data too, wouldn't it? Unlike ehcache? – matt b Apr 08 '09 at 23:54
  • I mean "odd" as in unusual not necessarily bad. Memcached is primarily associated with PHP. Java-specific solutions will be able to use Java serialization methods (inbuilt and customized) and generally just fit better. Of course there mgiht be another reason like also using PHP, .Net, etc. – cletus Apr 08 '09 at 23:54
  • Both links are now dead, unfortunately – mauhiz Oct 28 '14 at 23:23