MOM: Memcached Operations Monitoring

Dustin Sallings dustin at spy.net
Thu Oct 11 22:17:46 UTC 2007


On Oct 11, 2007, at 14:16 , Randy Wigginton wrote:

> I have modified memcached as well as the java client library; with  
> these modifications, and very few lines of code in the application,  
> I can tell precisely how many URLs and SQLs are executing on a  
> particular machine in any given minute or in any given hour.  I can  
> tell you the average execution time, the maximum execution time, as  
> well as the number of failures.  I can tell you which URLs were  
> expensive, which URLs invoked SQL statements, which urls failed  
> most often.  Coupled with a small mysql database, I can give you  
> more operational statistics on our site than many larger sites have  
> available.

	I do a similar thing in application with a small amount of java  
code.  If I had to guess, it sounds like you want to do the same kind  
of thing I'm doing, but in memcached instead of in a server instance.

	Mine has a couple of forms:

	@TimedMethod("blah.doSomething")
	public Something doSomething(...) {
		// expensive stuff
	}

	With the above, I automatically get stats that look like this (time  
units in milliseconds):

blah.doSomething = compstat: count=26345 sum=461399.000000  
min=7.000000 avg=17.513722 davg=17.517460 max=1731.000000  
stddev=66.180928

	You can also directly use the stats and do your own timings within  
code (or use a simple counter variant).

	The counter variant is analogous to incr.  Adding a similar data  
structure to keep running timing stats would be pretty cheap and  
easy, but I don't know how generally applicable it'd be.  You'd lose  
the general discoverability I rather like, and you'd have to modify  
your key space to include the origin server somehow.

	How does yours work?

-- 
Dustin Sallings




More information about the memcached mailing list