-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Reduce performance impact of ExitableDirectoryReader #53978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pinging @elastic/es-search (:Search/Search) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left two comments
@@ -276,7 +276,7 @@ public void visit(int docID, byte[] packedValue) throws IOException { | |||
|
|||
@Override | |||
public PointValues.Relation compare(byte[] minPackedValue, byte[] maxPackedValue) { | |||
queryCancellation.checkCancelled(); | |||
checkAndThrowWithSampling(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should throttle this. We don't have enough evidence that it's slowing down the request so I'd keep it as is for now.
this(reader, similarity, queryCache, queryCachingPolicy, new MutableQueryTimeout()); | ||
QueryCache queryCache, QueryCachingPolicy queryCachingPolicy, | ||
boolean wrapWithExitableDirReader) throws IOException { | ||
this(reader, similarity, queryCache, queryCachingPolicy, wrapWithExitableDirReader ? new MutableQueryTimeout() : null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use the cancellable even if the low level cancellation is set to false (query timeout option and bulk scorer) so we should never set the cancellable to null
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, sure, I just pushed it to check some other compilation stuff. it's not ready yet, but thx!
Benchmarking showed that the effect of the ExitableDirectoryReader is reduced considerably when checking every 4095 docs. Moreover, set the cancellable task before calling QueryPhase.preProcess() and make sure we don't wrap with an ExitableDirectoryReader at all when lowLevelCancellation() is set to false to avoid completely any performance impact. Follows: elastic#52822 Follows: elastic#53166 Follows: elastic#53496
701af61
to
8f23bc7
Compare
Benchmark results:
Every 511 docs against before the ExitableDirectoryReader:
Every 1023 docs against before the ExitableDirectoryReader:
Every 2047 docs against before the ExitableDirectoryReader:
Every 4095 docs against before the ExitableDirectoryReader:
Every 8191 docs against before the ExitableDirectoryReader:
|
I'm leaning towards 8191 instead of 4095 (current status in the PR). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's use 2^13
to be on the safe side. We can revise later if need to.
Benchmarking showed that the effect of the ExitableDirectoryReader is reduced considerably when checking every 8191 docs. Moreover, set the cancellable task before calling QueryPhase#preProcess() and make sure we don't wrap with an ExitableDirectoryReader at all when lowLevelCancellation is set to false to avoid completely any performance impact. Follows: #52822 Follows: #53166 Follows: #53496 (cherry picked from commit cdc377e)
Benchmarking showed that the effect of the
ExitableDirectoryReader
is reduced considerably when checking every 8191 docs. Moreover,
set the cancellable task before calling
QueryPhase#preProcess()
and make sure we don't wrap with an
ExitableDirectoryReader
at allwhen
lowLevelCancellation
is set to false to avoid completely anyperformance impact.
Follows: #52822
Follows: #53166
Follows: #53496