Memcache not freeing memory when a key expires

Jason Rimmer jrimmer at irth.net
Tue Feb 28 15:18:28 UTC 2006


	I'm on the list digest so my apologies if this has already been addressed:
	Why would you do this; what purpose would the reaper serve?  As Brad 
mentioned previously memcached is an LRU cache with essentially a lazy 
'reaper' to maintain O(1).  In general an active reaper would have two 
purposes: 1) Remove expired entries to make room for more and 2) Ensure 
that expired entries are no longer accessible.  Brad addressed both 
points in that for the first case expired entries are automatically 
removed via LRU when memcached comes under memory pressure.  With the 
second case memcached ensures that expired entries are not retrievable 
(the fact that those entries happen to be removed or 'reaped' when 
accessed is orthogonal to the retrieval attempt).
	What are you trying to accomplish with your active reaper and how will 
the reaper know that a key is expired and hence appropriate for 'removal'?

 > Date: Mon, 27 Feb 2006 18:27:16 -0800
 > From: "Stephen Corgiat" <nitelord at gmail.com>
 > Subject: Re: Memcache not freeing memory when a key expires
 > To: "Brad Fitzpatrick" <brad at danga.com>
 > Cc: memcached at lists.danga.com
 > Message-ID:
 > 	<3a0db3120602271827n34c6968fg711ee1061e0fd412 at mail.gmail.com>
 > Content-Type: text/plain; charset="iso-8859-1"
 >
 > Thanks for your response..
 >
 > Good to know if this was really the way it was supposed to work,
 > hopefully someone else finds this if they're wondering the same thing.
 >
 > Since we love memcached so much and would like to continue using it
 > for our site, we decided to code in a "reaper" command which deletes
 > keys that have
 > expired.  We're testing it out and so far so good.
 >
 > - Stephen

-- 
Jason Rimmer
jrimmer at irth dot net


More information about the memcached mailing list