divijvaidya commented on code in PR #13275: URL: https://github.com/apache/kafka/pull/13275#discussion_r1255757382
########## storage/src/main/java/org/apache/kafka/storage/internals/log/RemoteIndexCache.java: ########## @@ -16,6 +16,9 @@ */ package org.apache.kafka.storage.internals.log; +import com.github.benmanes.caffeine.cache.Cache; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.RemovalCause; Review Comment: Hey Jun Caffeine is being used for many years in other latency/memory sensitive projects such as Solr, Cassandra. Solr: It is being used in Apache Solr since 2019[1]. From their release doc[2]: > Users are encouraged to transition their cache configurations to use org.apache.solr.search.CaffeineCache as soon as feasible. Cassandra: It is being used in Cassandra since 2017 for performance critical caches. Now, about the weak references, please note that weak & soft references are optional [4], and we don't use weak/soft references in this implementation.. The keys and values are by default stored with strong references. You can see this information at the javadoc [4] the `newBuilder()` method we are using. Quoting from there: > Constructs a new Caffeine instance with default settings, including strong keys, strong values, and no automatic eviction of any kind. Personally, outside of Kafka, I have used this cache in query execution path of database internals and it hasn't caused any problems. Please let me know if you have further question about it's usage. Happy to explain more! [1] https://issues.apache.org/jira/browse/SOLR-8241 [2] https://solr.apache.org/guide/8_4/solr-upgrade-notes.html#Caches [3] https://issues.apache.org/jira/browse/CASSANDRA-10855 [4] https://www.javadoc.io/doc/com.github.ben-manes.caffeine/caffeine/2.0.3/com/github/benmanes/caffeine/cache/Caffeine.html#newBuilder-- -- 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]
