-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Combine small pages in Limit #128531
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
Combine small pages in Limit #128531
Conversation
|
Hi @dnhatn, I've created a changelog YAML for you. |
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
| OperatorStatus exchangeSink = driverProfile.operators().get(2); | ||
| assertThat(exchangeSink.status(), instanceOf(ExchangeSinkOperator.Status.class)); | ||
| ExchangeSinkOperator.Status exchangeStatus = (ExchangeSinkOperator.Status) exchangeSink.status(); | ||
| assertThat(exchangeStatus.pagesReceived(), lessThanOrEqualTo(1)); |
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 was expecting this to be strictly equalTo(1). When this could be 0?
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.
It could be 0 if early termination kicks in.
|
|
||
| public LimitOperator(Limiter limiter) { | ||
| private final int pageSize; | ||
| private int pendingRows; |
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.
Could you move this one below the final ones? I just want to keep the mutable ones not mixed in.
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.
Sure, I regrouped these in c94c72c
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.
Thanks!
|
@idegtiarenko @nik9000 Thanks! |
💔 Backport failed
You can use sqren/backport to manually backport by running |
Currently, the Limit operator does not combine small pages into larger ones; it simply passes them along, except for chunking pages larger than the limit. This change integrates EstimatesRowSize into Limit and adjusts it to emit larger pages. As a result, pages up to twice the pageSize may be emitted, which is preferable to emitting undersized pages. This should reduce the number of transport requests and responses between clusters or coordinator-data nodes for queries without TopN or STATS when target shards produce small pages due to their size or highly selective filters.
Currently, the Limit operator does not combine small pages into larger ones; it simply passes them along, except for chunking pages larger than the limit. This change integrates EstimatesRowSize into Limit and adjusts it to emit larger pages. As a result, pages up to twice the pageSize may be emitted, which is preferable to emitting undersized pages. This should reduce the number of transport requests and responses between clusters or coordinator-data nodes for queries without TopN or STATS when target shards produce small pages due to their size or highly selective filters.
Currently, the Limit operator does not combine small pages into larger ones; it simply passes them along, except for chunking pages larger than the limit. This change integrates EstimatesRowSize into Limit and adjusts it to emit larger pages. As a result, pages up to twice the pageSize may be emitted, which is preferable to emitting undersized pages. This should reduce the number of transport requests and responses between clusters or coordinator-data nodes for queries without TopN or STATS when target shards produce small pages due to their size or highly selective filters.
This PR reverts #128531. With #128531, the Limit operator was updated to combine smaller pages into a larger page to reduce overhead, such as the number of exchange requests. However, this has a significant implication: the combined larger page does not retain the attributes of the blocks from the smaller pages. For example, if the smaller pages have ordinal-based BytesRef blocks, the larger page will not. This can cause a significant slowdown if subsequent operators have optimizations for ordinal-based blocks. The Enrich operator has such optimizations, and our benchmarks have shown this performance regression. One possible solution to reduce the regression is to set a threshold (e.g., 1000 rows), above which the Limit operator would pass the page along without combining. However, even with a threshold of 1000, the performance regression does not go away completely. Alternatively, we could allow exchange requests to return multiple pages (up to the page size limit). To minimize risk, this PR reverts the previous change, and we will reintroduce a new change later
|
Reverted in #129107 |
This PR reverts elastic#128531. With elastic#128531, the Limit operator was updated to combine smaller pages into a larger page to reduce overhead, such as the number of exchange requests. However, this has a significant implication: the combined larger page does not retain the attributes of the blocks from the smaller pages. For example, if the smaller pages have ordinal-based BytesRef blocks, the larger page will not. This can cause a significant slowdown if subsequent operators have optimizations for ordinal-based blocks. The Enrich operator has such optimizations, and our benchmarks have shown this performance regression. One possible solution to reduce the regression is to set a threshold (e.g., 1000 rows), above which the Limit operator would pass the page along without combining. However, even with a threshold of 1000, the performance regression does not go away completely. Alternatively, we could allow exchange requests to return multiple pages (up to the page size limit). To minimize risk, this PR reverts the previous change, and we will reintroduce a new change later
This PR reverts elastic#128531. With elastic#128531, the Limit operator was updated to combine smaller pages into a larger page to reduce overhead, such as the number of exchange requests. However, this has a significant implication: the combined larger page does not retain the attributes of the blocks from the smaller pages. For example, if the smaller pages have ordinal-based BytesRef blocks, the larger page will not. This can cause a significant slowdown if subsequent operators have optimizations for ordinal-based blocks. The Enrich operator has such optimizations, and our benchmarks have shown this performance regression. One possible solution to reduce the regression is to set a threshold (e.g., 1000 rows), above which the Limit operator would pass the page along without combining. However, even with a threshold of 1000, the performance regression does not go away completely. Alternatively, we could allow exchange requests to return multiple pages (up to the page size limit). To minimize risk, this PR reverts the previous change, and we will reintroduce a new change later
Reverted in #129107
Currently, the Limit operator does not combine small pages into larger ones; it simply passes them along, except for chunking pages larger than the limit. This change integrates EstimatesRowSize into Limit and adjusts it to emit larger pages. As a result, pages up to twice the pageSize may be emitted, which is preferable to emitting undersized pages. This should reduce the number of transport requests and responses between clusters or coordinator-data nodes for queries without TopN or STATS when target shards produce small pages due to their size or highly selective filters.