• Top
  • New

DragonFlydb: Cache Design

by anhldbk on 8/13/2022, 9:47:51 AM with 26 comments
  • by Andys on 8/16/2022, 11:03:47 AM

    It seems odd that the article doesn't mention Redis's LFU mode which improved on LRU since about 5+ years ago.

  • by jzelinskie on 8/16/2022, 3:07:58 PM

    Dash sounds super interesting. I hadn't heard of that until now.

    If 2Q sounds interesting see also the TinyLFU paper[0]. TinyLFU is the strategy used by Ristretto, the Go LFU cache used by Dgraph, Vitess, and SpiceDB. In the introduction of the paper it lists related works including 2Q and nice high level descriptions of alternatives.

    [0]: https://www.cs.technion.ac.il/~gilga/TinyLFU_PDP2014.pdf

  • by alecco on 8/16/2022, 10:53:35 AM

    Very cool.

    Other similar and interesting non-LRU caches:

    MySQL https://medium.com/@arpitbhayani/what-makes-mysql-lru-cache-...

    Intel Sandy Bridge+ https://blog.stuffedcow.net/2013/01/ivb-cache-replacement/

  • by alberth on 8/16/2022, 12:09:37 PM

    HN post from 3 months ago with 350+ comments.

    https://news.ycombinator.com/item?id=31560547

  • by magicalhippo on 8/16/2022, 1:52:22 PM

    To me, 2Q reminded me a lot of the ARC, Adaptive Replacement Cache[1], as I know it from ZFS.

    Mixing frequency of access with time of access seems to be a requirement for any cache that sees a mixed workload. On that note, has anyone tried frecency[2] for caching? I never gotten around to testing it myself and can't decide if it'd do a good job or not.

    [1]: https://en.wikipedia.org/wiki/Adaptive_replacement_cache

    [2]: https://wiki.mozilla.org/User:Jesse/NewFrecency?title=User:J...

  • by makmanalp on 8/16/2022, 2:59:36 PM

    MySQL approximates a hacky version of a similar idea with the bufferpool (newest additions don't go to the top of the LRU so they age out faster if not re-accessed) to avoid random full table scans from thrashing the cache:

    https://dev.mysql.com/doc/refman/5.7/en/innodb-performance-m...

  • by antirez on 8/16/2022, 3:10:45 PM

    Redis has LFU, implemented many years ago.