kaivalnp commented on PR #13202:
URL: https://github.com/apache/lucene/pull/13202#issuecomment-2025776234

   > I am guessing the `QueryTimeout` object has to do some global syncing to 
determine the current runtime to check
   
   I have used the default 
[`QueryTimeoutImpl`](https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/index/QueryTimeoutImpl.java)
 class, which makes `System.nanoTime()` calls to check for a timeout at every 
`shouldExit()` call
   
   > but I am not sure we should check for timeout on every single vector.
   
   Perhaps this can be configured by the end-user themselves, by making actual 
timeout checks after every TK number of calls, according to acceptable latency 
/ accuracy tradeoffs?
   
   For example, I modified the `shouldExit()` function 
[here](https://github.com/apache/lucene/blob/69d846f700a66972104ada26f569d34efd14d560/lucene/core/src/java/org/apache/lucene/index/QueryTimeoutImpl.java#L57-L60)
 from:
   
   ```java
   return timeoutAt != null && nanoTime() - timeoutAt > 0;
   ```
   
   to
   
   ```java
   // count is an integer initialized to 0
   return timeoutAt != null && ++count % 100 == 0 && nanoTime() - timeoutAt > 0;
   ```
   
   to check the timeout every 100 vectors, and the latency overhead with a 
`Long.MAX_VALUE` timeout got cut in half. Correspondingly, the latency with a 
`1 ms` timeout increased because we check the timeout less frequently, but all 
of this is expected


-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to