A high performance caching library for Java (by ben-manes)


Basic Caffeine repo stats
8 days ago

ben-manes/caffeine is an open source project licensed under Apache License 2.0 which is an OSI approved license.

Caffeine Alternatives

Similar projects and alternatives to Caffeine

  • GitHub repo linux

    Linux kernel source tree

  • GitHub repo xxHash

    Extremely fast non-cryptographic hash algorithm

  • GitHub repo glommio

    Glommio is a thread-per-core framework that aims to make the task of writing highly parallel asynchronous application in a thread-per-core architecture easier for rustaceans

  • GitHub repo nocache

    minimize caching effects

  • GitHub repo cache-trace

  • GitHub repo Segcache

  • GitHub repo Caffeinated

    Java 8 source preprocessor, adds new "caf expressions" to Java to help reduce boilerplate.

NOTE: The number of mentions on this list indicates mentions on common posts. Hence, a higher number means a better Caffeine alternative or higher similarity.


Posts where Caffeine has been mentioned. We have used some of these posts to build our list of alternatives and similar projects - the last one was on 2021-04-19.
  • Linux Kernel: The multi-generational LRU | 2021-04-19
  • Segcache: A memory-efficient and scalable key-value cache for small objects [pdf] | 2021-04-12
    A multi-threaded benchmark of a cache should be fully populated and use a scrambled Zipfian distribution. This emulates hot/cold entries and highlights the areas of contention (locks, CASes, etc). A lock-free read benefits thanks to cpu cache efficiency causing super linear growth.

    This shows if the implementation could be a bottleneck and scales well enough, after which the hit rate and other factors are more important than raw throughput. I would rather sacrifice a few nanos on a read than suffer much lower hit rates or have long pauses on a write due to eviction inefficiencies.


  • Multigenerational LRU: more performant, versatile, straightforward than Linux's | 2021-03-13
    I would recommend W-TinyLFU [1]. It offers higher hit rates, is adaptive, has lower metadata overhead, is O(1), and is the only policy that is robust against all workload patterns we have tried. This is what I proposed to the Linux folks when analyzing DClock.

    I met Kirk McKusick (BSD fame) at Fast'20 where he expressed interest in that for ZFS. We tried introducing the idea to the contributors at FreeBSD, Delphix, and LLNL. There is frustration at ARC being memory hungry and the locking is expensive. Unfortunately while interest in replacing ARC, all of our contacts were too busy to explore that option.

    [1] | 2021-03-13
    There's some really good explanation (and implementation) in the Caffeine library[1]. Ben Manes worked with Gil Einziger on the implementation and actually contributed to an updated version of the TinyLFU paper, IIRC. Gil has a ton of very relevant work[2][3] around cache admission, control, and information density.

    Unfortunately cache admission is an understudied and woefully unimplemented area of CS & computer engineering as far as I can tell. There's some decent work around hardware layer problems, cache line insertion/eviction/etc, but not much in general purpose software caching. Gils research was definitely the most relevant and relatable when I was involved in this area a few years back.

    [1] | 2021-03-13
    to see how similar they are.

    ARC obtained a lot of awareness but the hit rate is not that great. It is modestly better than LRU, but very wasteful in metadata overhead. LIRS is much better, except it is complex and the paper is confusing so almost all implementations are broken. DClock seems okayish by borrowing LIRS' ideas, but I think it performs worse in most comparisons.




  • Caffeinated, a work-in-progress preprocessor for Java ~8. | 2021-01-27
    Please note that Caffeine is a widely used Java cache library, which makes the name of your project a bit of confusing.
  • Is it necessary to learn later versions of Java? | 2021-01-08
    The one nice thing guava has (caches) has an alternative lib that does the job better (Caffeine )
  • How to Build an LRU Cache in Less Than 100 Lines of Code
    Caffeine (which uses TinyLFU) performs very well:
  • Git | 2020-12-28