<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-flowed"
 style="font-family: -moz-fixed; font-size: 12px;" lang="x-unicode">Hi,
<br>
<br>
we wrote an external garbage collector for memcached and it works fine.
<br>
We would like to make it available as an open source software. Is this
interesting to the members of this list?
<br>
Please let me know where we can post it.
<br>
<br>
The story:
<br>
<br>
We apply memcached to cache all kinds of items of a largish website
written in php.
<br>
We found it's working great!
<br>
<br>
But after a couple of days of usage we began to have problems. These
problems were helped by restarting memcached.
<br>
After having a closer look at these problems, it appeared that the
memory was gradually getting full.
<br>
This was kind of strange, because we use an expiration time of 6 hours,
which would mean that after a couple of days all items would have to be
evicted except those that were put in the last 6 hours.
<br>
<br>
We suspected that most of the expired items stay in the cache and never
get evicted, because the value of the STATS evictions was always 0 and
because we found a lot of items older than 6 hours.
<br>
<br>
The only place I found in the code where evictions are taking place is
in do_item_alloc, which means that an item can only be evicted in the
case when there is the need for allocating a new item. This means there
is no separate garbage collection as such in memcached. This is good,
because that would need lots of CPU ticks to run, lowering the
performance of the cache.
<br>
<br>
We found that we need to evict expired items from the cache and
therefore we implemented an external garbage collector. We run this
program regularly and we found that this solves our problem. This
means, memory usage is constantly low now.
<br>
<br>
And once again:
<br>
<br>
We would like to make it available as an open source software. Is this
interesting to the members of this list?
<br>
Please let me know where we can post it.
<br>
<br>
Kind regards,
<br>
Ivan<br>
</div>
</body>
</html>