Patch: Collect per-object-type stats

Brad Fitzpatrick brad at
Mon Mar 5 18:31:17 UTC 2007

Seems fine!  And useful.

On Thu, 1 Mar 2007, Steven Grimm wrote:

> This is a patch we're running to collect more precise statistics on the
> objects in our caches. In addition to a cachewide "hit" and "miss"
> count, this tracks get/set/hit/miss stats based on key prefixes, where a
> "prefix" is delimited by a character of your choice. So, for example, if
> you use the default delimiter of ":", then "user:12345" and "user:34567"
> are considered to both be of type "user". Stats collection does have a
> (small) CPU impact, so it may be turned on and off at runtime. In the
> multithreaded version of the code, there is usually enough CPU time to
> spare; we leave it turned on.
> Tracking stats with per-object-type granularity is valuable because
> different object types may have very different behavior that's
> impossible to discern from global stats; for example, the hit ratio on
> some of our objects is substantially lower than on others.
> This is a patch against the multithreaded branch since that's what we're
> running. It should work with minimal modification on the single-threaded
> source base -- pretty much just remove the lock/unlock calls. Note that
> the MT branch can still be compiled without thread support, so you don't
> have to actually use multiple threads to use this patch as is.
> Comments welcome, as always. If I don't hear any objections I'll commit
> this to the multithreaded branch in a little while.
> -Steve

More information about the memcached mailing list