jimczi commented on PR #16145: URL: https://github.com/apache/lucene/pull/16145#issuecomment-5871690243
We added a `NoReuseHint` recently in #16682, it might be useful here so let me give the context. It's a hint a format sets when it opens a file to say the data isn't worth keeping in memory. Not that it's read rarely, but that there's no reuse a cache can exploit, or the file is so much bigger than the rest of the index that holding it would push out things that do benefit. Today it's set by stored fields, term vectors, and the raw vectors that quantized formats keep only to rescore with. Those are also the files where we expect a prefetch to really miss. A rescore reads a few hundred raw vectors per query out of a file much bigger than everything else, and stored fields fetch the top N documents out of the largest file in the index. An HNSW search is the opposite, it reads the graph and the quantized vectors thousands of times a query and we want those resident, which is why they don't carry the hint. So the rule could be: if the open said no-reuse, skip the backoff and the probe and just issue the madvise. Everything else keeps whatever backoff you settle on. It's a tradeoff. When a no-reuse file does happen to be fully hot we pay a madvise we didn't need, but the same call is what saves a fault when it isn't, and that's the expensive side. On doing one isLoaded at the start of a query, I'm a bit wary, that's a lot of work on exactly the files that are meant to be the biggest. And whatever we pick, the input could remember the last page aligned range it advised and skip a call that falls inside it. No syscall, and several prefetches on the same page fold into one. Would that fit with where you're heading? -- 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]
