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
Prune unnecessary information from TransportNodesInfoAction.NodeInfoRequest #99938
Conversation
Pinging @elastic/es-data-management (Team:Data Management) |
As it stands this doesn't pass |
Got it.I will make sure my code passes ./gradlew precommit. |
I like that we extract |
Sure, i will do that refactoring first in a separate PR and then open this PR for the optimization. |
I do that refactoring in a this PR (#99990 ). Could you take a look? |
44499e2
to
511c984
Compare
I have updated commit. Could you please take a look? |
Much better :) But it still fails the BwC test suite as I mentioned above. |
Sorry, i forgot about that.I will make sure my code passes |
I can't even pass |
if (out.getTransportVersion().onOrAfter(NODE_INFO_REQUEST_VERSIONS_ADDED)) { | ||
this.nodesInfoMetrics.writeTo(out); | ||
} else { | ||
this.request.writeTo(out); |
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 think it would work to create a new NodesInfoRequest
right here just for sending out to older nodes (with no node IDs, just the metrics). That way we wouldn't have to keep track of the request and the metrics separately, because that's going to be problematic if we ever tried to send one of these things over the wire twice with two different transport versions.
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.
Big thanks, such a great idea! This way we don't have to worry about backwards compatibility. I have force pushed commits to make them easier to review. fa7c890
f36f302
to
fa7c890
Compare
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.
Ah sorry - this looks good for the BwC path but it's kind of a workaround and we'd want to remove it as soon as possible (i.e. in v9.0). For future versions we should be sending only a NodesInfoMetrics
as per your original commit.
Also please don't force-push to branches once they're being reviewed - as a reviewer it makes it much harder to keep track of what I have/haven't seen.
I pushed 7ccf073 adding a changelog entry for this PR - make sure to include that in future commits too please. |
Got it. In the future i will add a changelog and not force-push. |
For future versions i would like to do this work, at that time you can mention me.
|
Thanks for the offer! If we get this PR right then preparing for the 9.0 release will just be a case of removing the checks on transport versions, which is easiest done across the whole codebase in one go so, to set expectations, I doubt we will ask for help with that. |
I think i finally understand what you mean. We only track |
I think you meant the other way around: to current/future versions we want to send a bare |
…ut older nodes require us to send a complete NodesInfoRequest
Yes, that's a clerical error. I pushed b058d43 . |
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.
Looks great, one naming nit/suggestion and then I expect this is ready to go.
transport version naming Co-authored-by: David Turner <david.turner@elastic.co>
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
@elasticmachine test this please |
Thanks for your review David :) |
You're welcome @NEUpanning , thanks for your contribution! |
It's my pleasure and I learned a lot. |
…equest (elastic#99938) There's no need to include the whole top-level `NodesInfoRequest` in the requests for info from individual nodes, and this can add substantial overhead if there are lots of nodes in the cluster. With this commit we drop the wrapper in favour of just the parts of the top-level request needed for the node-level processing. Relates elastic#99744
I would like to make this change to |
Sounds good to me, yes. I think the same approach with 2 PRs will work fine there too. |
FWIW we have the same inefficiency in several other places too, I opened #100878 to list them all. |
I did the first step, refatoring NodesStatsRequest in #100883 |
Today every node-level
TransportNodesInfoAction.NodeInfoRequest
carries the entire top-levelNodesInfoRequest
, but it only needs to carry the metrics. The uneccessary information like nodes list incurs extra effort and network traffic.This commit trims these things down. There are certainly other places (e.g. ,
TransportNodesInfoAction.NodeStatsRequest
) where this pruning request would be valuable, but here we only focus on theTransportNodesInfoAction.NodeInfoRequest
for the performance optimization of nodes info action.Relates #99744