Cache miss stampedes

Kenner Stross kenner at superpowerplanet.com
Tue Jul 31 20:17:04 UTC 2007


I've been thinking about the question of cache miss stampedes and came
up with an idea this morning that I wanted to run by the group.

What if, for those items that were a real "cache miss stampede" risk
(i.e., very-high request rate and expensive to recover from db), you
randomly refetched from the db regardless of whether it was in the
cache?  For instance, on item X, the code will not even try memcache and
instead go to the db every 1 out of 1000 times.  On those randomly
chosen times, the db value is used to refresh memcache, whether or not
it had expired.  The denominator would have to be carefully chosen to
match the actual usage patterns, of course.  You would want a number
such that the db retrieval wasn't happening too often, but was often
enough that the item would have almost a nil probability of expiring
naturally.  In our example here, using a once-per-one-thousand rate, you
would still get most of the benefit of caching (your db access for item
X has been reduced by a factor of 1000), and pretty much eliminate the
risk of a cache miss stampede.

Whadya think?

Kenner

-----Original Message-----
From: memcached-bounces at lists.danga.com
[mailto:memcached-bounces at lists.danga.com] On Behalf Of Ask Bjørn Hansen
Sent: Friday, July 27, 2007 7:41 PM
To: Timothy Appnel
Cc: Brad Fitzpatrick; memcached at lists.danga.com
Subject: Re: Cache miss stampedes


There is a gearman list - find the main danga mailman page and go from  
there.

We are several subscribers, come join the party.  :-)

-- 
http://develooper.com

On Jul 27, 2007, at 5:08 PM, "Timothy Appnel" <tim at appnel.com> wrote:

> On 7/27/07, Brad Fitzpatrick <brad at danga.com> wrote:
>> This is totally the wrong list, but...
>
> Sorry. Where should I have posted that question? I couldn't find 
> mention of a mailing list for Gearman or TheSchwartz. Thanks for the 
> explanation. <tim/>




More information about the memcached mailing list