ben-manes commented on PR #23052: URL: https://github.com/apache/pulsar/pull/23052#issuecomment-2241246130
I'm not quite sure why expiration would have such a slowdown, but it is an expensive policy. Caffeine implements it in O(1) time, but calls to check if the retrieved entry has expired is usually the dominant cost. An unbounded ConcurrentHashMap is the baseline and the cache can only try to minimize the overhead of applying the eviction policies to that. The benchmark is single threaded, which means contention on computeIfAbsent won't be observed, and does not consume the return value, which allows for dead code elimination. These are probably not the root problem in them directly, but the full system benchmark still wouldn't make sense if you can do 5M ops/s per thread in the caches, assuming lock contention and clock sources were not a problem. Usually Guava suffers from contention (as shown in the original post), Caffeine doesn't, and if the same then it hints to the kernel clock source ([description](https://blog.packagecloud.io/system-calls-are-much-slower-on-ec2/)). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
