[ https://issues.apache.org/jira/browse/CASSANDRA-10855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15055544#comment-15055544 ]
ASF GitHub Bot commented on CASSANDRA-10855: -------------------------------------------- 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 <ben.ma...@gmail.com> 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 <ben.ma...@gmail.com> Date: 2015-12-14T06:44:17Z Switch usage of Guava caches to Caffeine ---- > Use Caffeine (W-TinyLFU) for on-heap caches > ------------------------------------------- > > Key: CASSANDRA-10855 > URL: https://issues.apache.org/jira/browse/CASSANDRA-10855 > Project: Cassandra > Issue Type: Improvement > Reporter: Ben Manes > Labels: performance > > Cassandra currently uses > [ConcurrentLinkedHashMap|https://code.google.com/p/concurrentlinkedhashmap] > for performance critical caches (key, counter) and Guava's cache for > non-critical (auth, metrics, security). All of these usages have been > replaced by [Caffeine|https://github.com/ben-manes/caffeine], written by the > author of the previously mentioned libraries. > The primary incentive is to switch from LRU policy to W-TinyLFU, which > provides [near optimal|https://github.com/ben-manes/caffeine/wiki/Efficiency] > hit rates. It performs particularly well in database and search traces, is > scan resistant, and as adds a very small time/space overhead to LRU. > Secondarily, Guava's caches never obtained similar > [performance|https://github.com/ben-manes/caffeine/wiki/Benchmarks] to CLHM > due to some optimizations not being ported over. This change results in > faster reads and not creating garbage as a side-effect. -- This message was sent by Atlassian JIRA (v6.3.4#6332)