[ https://issues.apache.org/jira/browse/SOLR-13817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16949630#comment-16949630 ]
Ben Manes commented on SOLR-13817: ---------------------------------- You might also want to review whether atomic computations (loading through the cache) would provide a performance benefit. This is supported by Caffeine (built on {{computeIfAbsent}}) and avoids performing costly redundant work. It probably isn't worth the effort to implement it in the other caches if they are eventually removed. For example {{RptWithGeometrySpatialField}} and {{BlockJoinParentQParser}} show classic patterns of a racy get-compute-put idiom: {code} SolrCache parentCache = request.getSearcher().getCache(CACHE_NAME); // lazily retrieve from solr cache Filter filter = null; if (parentCache != null) { filter = (Filter) parentCache.get(parentList); } BitDocIdSetFilterWrapper result; if (filter instanceof BitDocIdSetFilterWrapper) { result = (BitDocIdSetFilterWrapper) filter; } else { result = new BitDocIdSetFilterWrapper(createParentFilter(parentList)); if (parentCache != null) { parentCache.put(parentList, result); } } return result; {code} If multiple threads require the same key then they will observe have a cache miss, perform an expensive call (or else why cached?), and insert their results. By using {{computeIfAbsent}} style call, this will be performed by one thread under a striped lock (hashbin lock) and the others will wait patiently for the results. If it was present, in Caffeine's case, it will be a lock-free read so there is no locking overhead. This avoids cache stampedes and can have a performance impact under load. > Deprecate legacy SolrCache implementations > ------------------------------------------ > > Key: SOLR-13817 > URL: https://issues.apache.org/jira/browse/SOLR-13817 > Project: Solr > Issue Type: Improvement > Security Level: Public(Default Security Level. Issues are Public) > Reporter: Andrzej Bialecki > Assignee: Andrzej Bialecki > Priority: Major > > Now that SOLR-8241 has been committed I propose to deprecate other cache > implementations in 8x and remove them altogether from 9.0, in order to reduce > confusion and maintenance costs. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org