camster at citeulike.org
Thu Aug 11 05:49:17 PDT 2005
On 11 Aug 2005, at 13:05, Richard Cameron wrote:
> To me, this appears to be a one-in-one-out policy, and I think what
> I'm seeing is the case where there are a bunch of very small items
> at the end of the LRU, and I'm trying to insert something much larger.
... or (now that I actually read the source code properly), I'm
probably seeing that behaviour for slightly different reasons. Items
are bucketed together so that similar sized items live in the same
bucket, and there appears to be a separate LRU for each one.
Thus it's is an extremely clever hack for a single threaded
implementation which means that you've got a reasonable probability
of freeing up something of about the right size if something of about
the right size exists.
It's still an approximation to what could be done in an ideal world
in the cases where it's sensible to flush out lots of small old items
to make room for a new big one. It seems that all the LRUs are
completely independent at the moment.
More information about the memcached