dumping the cache contents

Ludovic Levesque luddic at gmail.com
Tue Jun 10 15:46:37 UTC 2008


Hi Grant,

you can have a little data usage report sniffing the network:
ngrep -W none -T -d any "^(get|set|delete|END|STORED|VALUE|DELETED)"
port 11211 | awk '{print $1 " " $2}'

or without the awk.

It's just plain keys and return values, but it can be useful to have a
look at what is used in cache.

Hope it helps
Ludo

On Tue, Jun 10, 2008 at 5:13 PM, Grant Maxwell
<grant.maxwell at maxan.com.au> wrote:
> thanks for the really fast response folks.
> I want it mostly for auditing, health checking and keeping an eye on the
> cache during this early implementation phase. Being able to cast an eye over
> some of our scalar entries would be particularly useful in this regard. If
> we could access the cache we could create summarised data usage reports and
> develop a sense of how the cache looks over time (trends) which would be
> better than just the stats.
> For example we have a scalar list with a counter. We just look to see if the
> counter exists and if it does we increment it. But the keys are (except for
> the prefix) dynamic and so we can't have a program which looks at the cache
> data (without knowing the keys) to generate a normal curve for the specific
> key hits. I know there are other ways to do this but I think the cache is
> the logical place to get the info from. Being able to analyze some of this
> data will also help us to learn about what is effective to have in the cache
> and what is not.
> regards
>
> Grant Maxwell
>
> On 11/06/2008, at 12:56 AM, Robert Swarthout wrote:
>
> As far as I know there is not a way to dump the contents of the cache even
> by using a prefix of the key.
>
> -Robert
>
>
> On 6/10/08 10:50 AM, "Grant Maxwell" <grant.maxwell at maxan.com.au> wrote:
>
> Hi again
>
> A bit more on this - Even if I could match a partial key. All my keys start
> as some string for example "ACA:mykey". If I could extract all "ACA:" type
> keys that would be very helpful. Almost all my keys/values are scalars.
> thanks
>
>
>
> Grant Maxwell
>
> P <mailto:joel.punch at nexos.com.au> please consider the environment before
> printing this e-mail
>
>
> On 11/06/2008, at 12:45 AM, Grant Maxwell wrote:
>
> Hi folks
>
> I am a new user for memcached - love it already. We are experiencing a
> better than expected hit rate. This is reducing load on sql and dns RBL
> lookups across several machines. Magic.
>
> Could you let me know if it is possible to dump out the contents of the
> cache ? I tried the following but without success. I thought it might return
> a hash of it all.
>
> my  $memd = new Cache::Memcached {
> 'servers' => [ "localhost:11211" ],
> 'debug' => 0,
> namespace => 'myCache:'
> };
>
> my $cache=$memd->get('myCache');
> print Dumper $cache;
>
> Just a point here - I have been programming in various languages for 20+
> years but perl is new to me so I might be overlooking an obvious :).
>
>
> regards
>
>
>
> Grant Maxwell
>
> P <mailto:joel.punch at nexos.com.au> please consider the environment before
> printing this e-mail
>


More information about the memcached mailing list