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
Variable deduplication in query planner #872
Conversation
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
✅ Deploy Preview for apollo-router-docs canceled.
|
This comment has been minimized.
This comment has been minimized.
Let's not merge this before GA. |
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 love this, with a timing catch. 😉
As long as we're doing deep comparisons on the representations, this is safe and desirable. This is also something that we've wanted to do for a very long time in the Gateway and something users have wanted!
With that in mind, my suggestion is that we either:
- Punting this until after GA; or
- Making this a configuration option that is off by default
I suspect my preference could be option 2.
My primary motivation for this suggestion is that I believe this could make it more challenging for adopters (e.g., SREs analyzing such a deployment) to accurately analyze the differences in behavior between the Gateway and the Router, which we have tried to keep largely the same. It would be easier if the shapes of the subgraph requests were as similar as possible — this might tie into whatever tool/diffs that come out of #765 if someone was comparing Router vs Gateway.
As a secondary motivation, because this is an optimization while we're in a push to GA (which I'd claim should primarily on stabilizing what we have, rather than new features that differentiate things from the Gateway — even if desirable!).
There are, I think, a number of users who are interested in this that have probably opened issues on the federation
repository that we might want to have try it out, so a configuration option could enable that. It's also just a great fast-follow to GA.
My one technical note on this PR is that I think it should introduce some tests, and administratively, looking for a CHANGELOG.md
.
Thoughts?
Deep comparisons should not be a huge issue, as the Hash implementation does it. If there's a case where a representation is similar but does not hash the same way (example: fields in different order), it should be safe, because it would only result in more data requested. |
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Discussed with @BrynCooke, let's merge it POST-GA |
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 still believe that this can be activated via the traffic shaping plugin.
QueryPlannerRequest should have QueryPlanOptions as a field and the traffic shaping plugin should mutate the options to enable dedup.
Ok if we're ok to expose the queryplan options then indeed I think it could work. But all logics about dedup will stay in core and not in the plugin itself, we're just talking about moving the configuration to the plugin. |
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
close #87
Before this change we had this
__entities
:Now we have:
in responses, but I also deduplicate in the requests so it's less traffic either on the request and the response.