GitHub user ben-manes opened a pull request:
https://github.com/apache/cassandra/pull/59
CASSANDRA-10855: Use Caffeine for on-heap caches
[Caffeine](https://github.com/ben-manes/caffeine) is a Java 8 cache by the
author of ConcurrentLinkedHashMap and Guava's cache, which is what was
previously used. For the key and counter caches, the CLHM-based cache remains
as a fallback if needed, but is deprecated and scheduled for removal.
CLHM and Guava uses the LRU policy due to its simplicity, decent hit rate,
and known characteristics. Caffeine uses a near optimal policy,
[W-TinyLFU](http://arxiv.org/pdf/1512.00727.pdf), which has a significantly
[higher hit rate](https://github.com/ben-manes/caffeine/wiki/Efficiency). In
particular the hit rate in the paper shows a substantial gain on database and
search workloads.
The performance between CLHM and Caffeine caches should be similar, with
some possible gains in write throughput. Significant gains may be observed from
Guava, due to it never porting over some optimizations that improve read
throughput and avoid creating garbage as a side effect.
For a brief overview, see this
[article](https://www.voxxed.com/blog/2015/12/add-a-boost-of-caffeine-to-your-java).
This pull request is being tracked in
[CASSANDRA-10855](https://issues.apache.org/jira/browse/CASSANDRA-10855).
@jbellis @snazy
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ben-manes/cassandra caffeine
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cassandra/pull/59.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #59
----
commit 3435a5a2b6eee30210350d5dfe1f76203d9d0f35
Author: Ben Manes <[email protected]>
Date: 2015-12-14T06:22:04Z
Use Caffeine for key and counter on-heap caches
Caffeine is a Java 8 cache by the author of ConcurrentLinkedHashMap,
which is what was previously used. That cache remains as a fallback
if needed, but is deprecated and scheduled for removal.
CLHM uses the LRU policy due to its simplicity, decent hit rate, and
known characteristics. Caffeine uses a near optimal policy, W-TinyLFU,
which has a significantly higher hit rate. In particular the hit rate
in the paper shows a substantial gain on database and search workloads.
The performance between the two caches should be similar, with some
possible gains in write throughput.
Caffeine: https://github.com/ben-manes/caffeine
W-TinyLFU: http://arxiv.org/pdf/1512.00727.pdf
Overview:
https://www.voxxed.com/blog/2015/12/add-a-boost-of-caffeine-to-your-java
commit 91ac1fbf6e38704597befce9c280c516d61fb07a
Author: Ben Manes <[email protected]>
Date: 2015-12-14T06:44:17Z
Switch usage of Guava caches to Caffeine
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---