neoremind commented on PR #16145:
URL: https://github.com/apache/lucene/pull/16145#issuecomment-5885100217

   @jimczi The NoReuseHint idea looks sensible. In essence, the power-of-two 
counter and the isLoaded probe are meant to skip madvise on a page that is 
probably already in RAM, they are optimized for hot case. On mostly cold, they 
are neutral. The problem is the mixed warm/cold case, the counter and probe 
inference is not working at best when hits and misses interleave.
   
   I think NoReuseHint on stored fields, term vectors and the raw rescore 
vectors is a good signal to the runtime here. Like you said, these are the 
relative larger files compared with index files, and each query touches 
scattered pages, so pages are tend to less being revisited and age out under 
LRU. Graph and postings like pages, they tend to be re-touched and re-warmed. 
So NoReuseHint can indicate the file has higher probability of being cold, and 
issuing the madvise more aggressive could be better. For everything else, the 
files that tend to stay hot, keeping the backoff and probe is still worth it to 
avoid the madvise overhead, this is proved in my previous # 1 hot case, 
always-prefetch was 26–40% slower than the current backoff + probe.
   
   So I think the two strategies could compound together. NoReuseHint covers 
the files where a static assumption is justified by file relevant size and 
access pattern. A slower-climbing or capped backoff that @michaeljmarshall 
might be looking at, covers other index files, tries to balance hot case and 
mixed over a large-than-RAM case under pressure. Maybe keep both?
   
   Regarding isLoaded() probe, I am thinking keeping it even on the no-reuse 
path (always-prefetch) if we were to do. My rationale is that from the micro I 
ran on EC2 c6id.4xlarge reading 4k page: when the page is warm, the probe costs 
0.57us vs madvise 0.33us at T1, but 1.28us vs 2.5us at T8 since madvise 
contends worse than mincore if threads increase. When cold, indeed the probe 
adds overhead, but it is smaller compared with madvise, madvise 5.3us + delta 
overhead 0.43us at T1, and madvise 42us + delta overhead 1.25us at T8. This is 
also what I want to call out as different numbers with @michaeljmarshall last 
posted table.


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