[
https://issues.apache.org/jira/browse/LUCENE-8855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16864245#comment-16864245
]
Adrien Grand commented on LUCENE-8855:
--------------------------------------
I had the temptation to make Query implement Accountable a couple times over
the past years but I never liked it as it felt like something that is only
really useful in esoteric cases when memory usage of the cache keys - queries -
is not negligible compared to what is being cached. I'd rather not implement
Accountable.
My preference would be to either rely on the existing Weight#isCacheable logic,
which disables caching on large queries (see e.g.
https://github.com/apache/lucene-solr/blob/fbd05167f455e3ce2b2ead50336e2b9c2521cd6c/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java#L337-L342)
so that queries that are used as cache keys are always small. Or alternatively
compute a rough estimate of the memory usage of queries on top of the Query API
by using the query visitor API and some heuristics.
> Add Accountable to Query implementations
> ----------------------------------------
>
> Key: LUCENE-8855
> URL: https://issues.apache.org/jira/browse/LUCENE-8855
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Andrzej Bialecki
> Assignee: Andrzej Bialecki
> Priority: Major
> Attachments: LUCENE-8855.patch, LUCENE-8855.patch
>
>
> Query implementations should also support {{Accountable}} API in order to
> monitor the memory consumption e.g. in caches where either keys or values are
> {{Query}} instances.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]