What Does Memcached's LRU Actually Mean?
Asked Answered
I

1

9

Memcached says it uses an LRU queue to do eviction (with a few rules based around slab sizes mixed in.) When they say least-recently-used, are they referring to least recently stored or least recently read? Their documentation seems ambiguous here.

Incompressible answered 23/6, 2010 at 20:1 Comment(0)
O
16

Everywhere I've seen the term used, LRU has referred to the last access (read or write) rather than the last store.

This article confirms it:

The LRU algorithm ensures that the object that is removed is one that is either no longer in active use or that was used so long ago that it’s data is potentially out of date or of little value.

It goes on to talk about items which are in "active use" - which to me strongly implies that it's access rather than storage... you wouldn't talk about something "actively being stored" unless you're halfway through actually writing it.

Othilie answered 23/6, 2010 at 20:3 Comment(2)
Will the LRU Algorithm rather delete entries that have not been used for some amount of time or expired items? Entries that are expiring are not deleted on that exact moment but when the next time someone tries to access it (AFAIR). So will the LRU Algorith (also) account for the expiry of keys?Photocopier
@zaphod1984: That entirely depends on the implementation. If you're asking about memcached in particular, I don't know.Othilie

© 2022 - 2024 — McMap. All rights reserved.