[ 
https://issues.apache.org/jira/browse/ARTEMIS-4349?focusedWorklogId=869681&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-869681
 ]

ASF GitHub Bot logged work on ARTEMIS-4349:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Jul/23 01:54
            Start Date: 07/Jul/23 01:54
    Worklog Time Spent: 10m 
      Work Description: ben-manes commented on PR #4540:
URL: 
https://github.com/apache/activemq-artemis/pull/4540#issuecomment-1624526398

   Hi,
   
   If you do not have a performance reason to switch then staying with Guava's 
is perfectly fine. I would not use their `asMap().compute` as a wonky 
implementation given it was added so late (and you don't use it, so that's 
fine). Guava's is robust but not actively maintained (CacheBuilder's JavaDoc 
recommends Caffeine).
   
   The most common cause for tests to fail during a migration is that Caffeine 
switches eviction and listeners to be executed async by default, whereas Guava 
piggybacks on the calling thread. You can emulate that using 
`Caffeine.executor(Runnable::run)` if desired. The problem is that often tests 
assumed no concurrency (immediate eviction or callbacks invoked) and that is no 
longer a valid assumption. In both cache's their internal logic is very 
inexpensive (e.g. LRU reordering), but we do not know the cost of the user's 
callback. Since the JVM now offers shared threads and Caffeine offers an 
AsyncCache, defaulting to async to minimize user-facing latencies seemed like a 
reasonable choice. There are other subtle differences, such as if assuming lru 
eviction order, so you might want to review this [migration 
page](https://github.com/ben-manes/caffeine/wiki/Guava).
   
   Whatever you decide to do is fine with me. Feel welcome to reach out if you 
have any questions or concerns.




Issue Time Tracking
-------------------

    Worklog Id:     (was: 869681)
    Time Spent: 1h 40m  (was: 1.5h)

> Replace Guava cache with Caffeine
> ---------------------------------
>
>                 Key: ARTEMIS-4349
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4349
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>    Affects Versions: 2.29.0
>            Reporter: Alexey Markevich
>            Priority: Major
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> based on benchmark https://github.com/ben-manes/caffeine/wiki/Benchmarks



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to