-
Notifications
You must be signed in to change notification settings - Fork 272
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
Enable generate_query_fragments
by default
#6013
Changes from all commits
be83e30
ee0975d
cd3c249
1daae5d
51e89cb
6f43f20
a6035eb
e807ff6
f1f45a7
0c40214
544ce20
f5e1898
b395dcc
592c45c
c51d105
e638565
820977e
d2379fe
c734f9b
bc2ae12
eef215d
bf90de4
236fba6
c3c86ac
2e235a8
e4190e1
45fb226
c571242
cb539c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
### Compress subgraph operations by generating fragments | ||
|
||
The router now compresses operations sent to subgraphs by default by generating fragment | ||
definitions and using them in the operation. | ||
|
||
Initially, the router is using a very simple transformation that is implemented in both | ||
the JavaScript and Native query planners. We will improve the algorithm after the JavaScript | ||
planner is no longer supported. | ||
|
||
This replaces a previous experimental algorithm that was enabled by default. | ||
`experimental_reuse_query_fragments` attempted to intelligently reuse the fragment definitions | ||
from the original operation. Fragment generation is much faster, and in most cases produces | ||
better outputs too. | ||
|
||
If you are relying on the shape of fragments in your subgraph operations or tests, you can opt | ||
out of the new algorithm with the configuration below. Note we strongly recommend against | ||
relying on the shape of planned operations as new router features and optimizations may affect | ||
it, and we intend to remove `experimental_reuse_query_fragments` in a future release. | ||
|
||
```yaml | ||
supergraph: | ||
generate_query_fragments: false | ||
experimental_reuse_query_fragments: true | ||
``` | ||
|
||
By [@lrlna](https://github.com/lrlna) in https://github.com/apollographql/router/pull/6013 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,6 +218,10 @@ mod tests { | |
build_mock_supergraph(serde_json::json! {{ | ||
"plugins": { | ||
"experimental.expose_query_plan": true | ||
}, | ||
"supergraph": { | ||
// TODO(@goto-bus-stop): need to update the mocks and remove this, #6013 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be linking to a new issue (6013 is the existing PR#)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The work would likely be done as part of removing |
||
"generate_query_fragments": false, | ||
} | ||
}}) | ||
.await, | ||
|
@@ -231,6 +235,10 @@ mod tests { | |
build_mock_supergraph(serde_json::json! {{ | ||
"plugins": { | ||
"experimental.expose_query_plan": true | ||
}, | ||
"supergraph": { | ||
// TODO(@goto-bus-stop): need to update the mocks and remove this, #6013 | ||
"generate_query_fragments": false, | ||
} | ||
}}) | ||
.await, | ||
|
@@ -245,6 +253,10 @@ mod tests { | |
let supergraph = build_mock_supergraph(serde_json::json! {{ | ||
"plugins": { | ||
"experimental.expose_query_plan": false | ||
}, | ||
"supergraph": { | ||
// TODO(@goto-bus-stop): need to update the mocks and remove this, #6013 | ||
"generate_query_fragments": false, | ||
} | ||
}}) | ||
.await; | ||
|
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.
nit: I believe
Default::default()
for boolean is false. Should we update other defaults to explicit false as well (for readability)?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.
Indeed. I wanted to be explicit about this.
incremental_delivery
anddebug
are not booleans but structs, so i kept them asDefault::default
. We could consider manually writing out Default impls for those types.