bytes > limit_maxbytes and no evictions?

BUSTARRET, Jean-francois jfbustarret at wat.tv
Tue Jun 26 07:25:27 UTC 2007


I did write the original evictions patch.

I think you must be right : evictions are not incremented when exptime == 0 (but they should be, because those items are still valid, and the definition of evictions is "the number of valid items kicked out of the LRU").

AFAIK, the code should be :

diff -rup memcached-1.2.2/items.c memcached-1.2.2-new/items.c
--- memcached-1.2.2/items.c     2007-05-03 00:58:51.000000000 +0200
+++ memcached-1.2.2-new/items.c 2007-06-26 09:10:59.000000000 +0200
@@ -105,7 +105,7 @@ item *do_item_alloc(char *key, const siz

         for (search = tails[id]; tries > 0 && search != NULL; tries--, search=search->prev) {
             if (search->refcount == 0) {
-               if (search->exptime > current_time) {
+               if (search->exptime == 0 || search->exptime > current_time) {
                        STATS_LOCK();
                        stats.evictions++;
                        STATS_UNLOCK();

Can someone check and commit the patch ?

JFB

-----Message d'origine-----
De : memcached-bounces at lists.danga.com [mailto:memcached-bounces at lists.danga.com] De la part de Steve Webb
Envoyé : lundi 25 juin 2007 19:10
À : memcached at lists.danga.com
Objet : Re: bytes > limit_maxbytes and no evictions?

So, instead of patching, answer me this.  :)

"Evictions" = if an item was removed and set with a TTL of > now(), right?

If an item was set without a TTL, evictions is not incremented because we can calculate that?  (total_items - curr_items - evictions)

If so, then ignore my "patch" in the last email.  :)

- Steve

--
Steve Webb - Lead System Administrator for Pronto.com
Email: swebb at pronto.com  (Please send any work requests to: rt at pronto.com)
Cell: 303-564-4269, Office: 303-497-9367
YIM: scumola

On Mon, 25 Jun 2007, Steve Webb wrote:

> Date: Mon, 25 Jun 2007 10:08:50 -0600 (MDT)
> From: Steve Webb <swebb at pronto.com>
> To: memcached at lists.danga.com
> Subject: Re: bytes > limit_maxbytes and no evictions?
> 
> Hey.
>
> So I checked out the code and "evictions" is only incremented when the 
> data times out, which to me is not obvious.
>
> I changed the code to increment evictions when the cache is full and 
> an item is "pushed" out.
>
> Just add the line:
>
> stats.evictions++;
>
> to items.c:437 after the
>
> stats.curr_items -= 1;
>
> line.
>
> Can someone with svn access please add this to the source tree?  I 
> don't have svn access and I need to be able to monitor this statistic 
> and I'm guessing that others will also find this statistic 
> interesting.  We use it mainly to "tune" the size of a memcached 
> server.  A ton of evictions means that we need to increase the size of 
> the server.  Also, we chart this statistic, so a spike could signal a problem.
>
> - Steve
>
>


More information about the memcached mailing list