2 ms·
LRU isn't a panacea. Maintaining a real LRU can involve non-trivial overhead. It also can have trouble predicting some access patterns. Random replacement can d
by jasonwatkinspdx 17y ago
LRU isn't a panacea. Maintaining a real LRU can involve non-trivial overhead. It also can have trouble predicting some access patterns. Random replacement can definitely out perform LRU, particularly for tree structures.
- antirez 17y agoLRU has also memory overhead. So storing more data and using a less precise algorithm may be indeed better in some circumstances. Also there is no way to mount a precise LRU schema that is O(1). O(log(N)) complexity is needed.
- wanderr 17y agoDo you know how memcached does it? Do they pay the performance overhead, or do they cheat in some way? I don't think perfect LRU is needed, but the general idea behind LRU works /very/ well for a memcached style cache. Trying to achieve something similar using Redis by for example updating the expire on every read would be a bit of a pain and I think put extra load on the client and server. This isn't a complaint about Redis though, it has its own use cases which are wonderful and I have no objection to using both for their strengths.