sgup432 commented on PR #16657:
URL: https://github.com/apache/lucene/pull/16657#issuecomment-5626750729

   >Actually, looking at the implementation, I'm not convinced that we are 
properly accounting for query size in ramBytesUsed, since the cache entries are 
on the segment/query pairs. But we increment the query size contribution for 
each entry, even though it's probably the same query instance.
   
   But considering we are not doing any canonicalization at this point, so 
those N entries(across segments) hold N same Query instances. So counting the 
query size N times is actually accurate right now? 
   
   >Hmm... since eviction is managed on a per-partition basis, I don't think we 
can reasonably pull uniqueQueries up to the root, since we won't know when 
things should be evicted.
   
   Each partition does invoke `onCacheEntryEvicted` which can probably used or 
something similar at a global level. Though there are other points like 
`clear()`(clearing all entries per partition) which might be tricky to handle. 
We can still use `WeakReferences` logic and rely on GC to clear those entries, 
it may not be a very bad idea.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to