Open tatsuya6502 opened 9 months ago
fwiw, I don't know if SLRU is helpful anymore. It very well may be and would make perfect sense to be, but I have not evaluated it for a very long time. The rational would be that the victim should have a historical high frequency and low recency or that sketch collisions might have mistakenly admitted an entry that could age out quickly. However, that aging only makes sense with jitter or else TinyLFU could excessively reject candidates due to an artificially hot victim.
If I remember correctly, I originally saw SLRU improve the WikiBench trace by a good margin. I later fixed flaws in my CountMin sketch that was introducing hash bias and recall that may have corrected it on that trace. I left it as is since I had already done all the work, the researchers had written the paper section, and I saw no downsides. It might help on traces or it may be busy work, I just don't know.
If you are in the mood of analyzing variations then you might try to see if it is worthwhile. But analyzing takes a lot of time so only do that if interested or it would save you work.
I started to implement Window-TinyLFU policy here: #249
As of
v0.12.4
, Moka supports only the TinyLFU cache policy. However, there are some requests and plans to support other cache policies. I am going to implement the LRU policy without refactoring the cache policy implementation, mainly due to time constraints. But, later when I have time, I would like to refactor it.Cache policies
I am not sure if 2. is worth implementing. But I could write a prototype implementation and run it against the Caffeine simulator (a Moka driver) to see how well it will do.
How these policies work
Read
TinyLFU
Window TinyLFU
LRU
Insert or Update
TinyLFU, with LRU eviction strategy
handle_upsert
evict_lru_entries
TinyLFU, with sampled LFU eviction strategy
handle_upsert
evict_lru_entries
Window TinyLFU
handle_upsert
evict_lru_entries
LRU
handle_upsert
evict_lru_entries