Skip to content
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

Subgraph support for query batching #4661

Merged
merged 87 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
eeb4be5
Some functionality for assembling batches
garypen Feb 12, 2024
bc131b0
milestone reached: round trip, simple batches, works.
garypen Feb 14, 2024
72a39ce
second milestone: complex batches are now working with caveats
garypen Feb 14, 2024
49d2bfa
Remove some of the code duplication
garypen Feb 14, 2024
e76c0df
fix my code reduction
garypen Feb 14, 2024
d5e92d3
Add some draft documentation for early evaluation by docs
garypen Feb 15, 2024
5ffd0c3
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Feb 15, 2024
553cb42
Draft changeset for the feature
garypen Feb 15, 2024
d99648e
create batching.rs and start to organise code more professionally
garypen Feb 16, 2024
ac9a0f8
remember to include the new source file in commits
garypen Feb 16, 2024
d2a3e10
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Feb 20, 2024
6e0b580
Rename core batching structs
garypen Feb 20, 2024
46d9bec
Introduce Waiter struct and make code xtask lint clean
garypen Feb 20, 2024
110c9ba
cleanup some of the code and add some comments about future work
garypen Feb 21, 2024
df6e4bf
Implement Waiter::assemble_batch
garypen Feb 21, 2024
015c860
extract get_uri_details() fn
garypen Feb 21, 2024
c9bbdf5
impl Drop for Batch until I figure out implications
garypen Feb 22, 2024
209e04d
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Feb 22, 2024
76e3aea
Introduce SubrequestBatchingError and clean up code a little
garypen Feb 22, 2024
9006b04
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Feb 22, 2024
b4f3d1e
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Mar 5, 2024
e3fef92
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Mar 5, 2024
cf254e6
Clean up the batching functionality a bit more
garypen Mar 5, 2024
7793bb7
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Mar 5, 2024
d1b7abd
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Mar 6, 2024
b19a267
add subgraph support to batching metrics
garypen Mar 7, 2024
5665508
Add a comment about the configuration work enabling subgraph filtering
garypen Mar 7, 2024
a6d3be5
Set operation name to "batch"
garypen Mar 7, 2024
afadbdd
make experimental_batching a commercial feature
garypen Mar 7, 2024
1fd3020
Add config for router-subgraph batching (#4777)
nicholascioli Mar 11, 2024
9743e8e
[Batching] Build upon the recent configuration changes to enable subg…
garypen Mar 12, 2024
be6d14d
Add missing unit tests for subgraph batching
nicholascioli Mar 12, 2024
a224e72
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Mar 14, 2024
95e20e8
Add integration tests for batching (#4795)
nicholascioli Mar 19, 2024
df13e10
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Mar 19, 2024
7612e34
Cleanup batching to handle aborted requests (#4825)
nicholascioli Mar 25, 2024
6733f73
Add batching cancellations to coprocessor (#4846)
nicholascioli Mar 26, 2024
224ab9d
restore imports that clippy complains about
garypen Mar 26, 2024
41d5826
[batching] fix subgraph unwrapping (#4849)
garypen Mar 26, 2024
b69543c
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Mar 26, 2024
3568a9c
[batching] Add tracing support for subgraph batching (#4854)
garypen Mar 27, 2024
617b9b7
Move batch query cancellation up (#4859)
nicholascioli Mar 27, 2024
a16cd9f
fix annoying clippy warning on macOS
garypen Mar 28, 2024
aa3a469
We only want the cfg to apply if it's a test compile
garypen Mar 28, 2024
617c074
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Mar 28, 2024
d3b7385
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 2, 2024
907776a
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 2, 2024
1760d1a
do some cleaning up of stuff that isn't part of this PR
garypen Apr 2, 2024
d77f5d6
remove one more superflouous file
garypen Apr 2, 2024
050d59b
remove changes we don't need any more
garypen Apr 2, 2024
debf5cf
Add a more robust `is_ready()` function for a batch
garypen Apr 2, 2024
c96c101
re-classify various tracing::info!() calls to tracing::debug!()
garypen Apr 2, 2024
91367ab
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 2, 2024
4161447
fix the otlp integration test
garypen Apr 2, 2024
ce554e2
Apply suggestions from code review
garypen Apr 3, 2024
7c13869
try to improve the docs based on Edward's comments (#4895)
garypen Apr 3, 2024
c658ad5
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 3, 2024
7a93557
[batching] first pass at fit and finish for production (#4915)
garypen Apr 5, 2024
dd01550
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 5, 2024
037cbe0
tighten up query_for_index() processing
garypen Apr 5, 2024
20b93b2
add some more unit tests to check message sending limits are correct
garypen Apr 5, 2024
e1a71d2
Apply suggestions from code review
garypen Apr 5, 2024
b1187e2
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 5, 2024
ea653e5
final pass through before opening review
garypen Apr 5, 2024
bad5eb9
Update docs/source/executing-operations/query-batching.mdx
garypen Apr 5, 2024
16955a5
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 5, 2024
eabebee
code review comments
garypen Apr 8, 2024
e47dce8
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 9, 2024
963d98f
Implement support for single item batches correctly
garypen Apr 9, 2024
90f3c01
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 9, 2024
af96ec9
Fix old bug so that batches with one query are returned as a batch
garypen Apr 9, 2024
be7da78
Convert recursive query_hashes() to iterative
garypen Apr 10, 2024
b74fc53
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 10, 2024
204961e
Use existing SubgraphConfiguration and rename call_batched_http
garypen Apr 11, 2024
86855ee
[batching] make batching look less racy (#4941)
garypen Apr 12, 2024
4d7f312
allow query deduplication and batching to work together
garypen Apr 12, 2024
13a816c
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 12, 2024
a01d118
changes in validation mean we need to change our snapshot
garypen Apr 12, 2024
ff7df9c
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 12, 2024
cd81ab7
Update docs/source/executing-operations/query-batching.mdx
garypen Apr 12, 2024
396dcc2
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 15, 2024
7267daa
update snapshot
garypen Apr 15, 2024
acb06cf
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 15, 2024
de2654c
Merge branch 'dev' into garypen/2002-subgraph-batching
garypen Apr 16, 2024
c33d0ca
code review comments
garypen Apr 16, 2024
33bafee
revert code review comment that lint didn't like
garypen Apr 16, 2024
feb1769
update docs to add enterprise stuff
garypen Apr 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .changesets/feat_garypen_2002_subgraph_batching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
### Subgraph support for query batching ([Issue #2002](https://github.com/apollographql/router/issues/2002))

As an extension to the ongoing work to support [client-side query batching in the router](https://github.com/apollographql/router/issues/126), the router now supports batching of subgraph requests. Each subgraph batch request retains the same external format as a client batch request. This optimization reduces the number of round-trip requests from the router to subgraphs.

Also, batching in the router is now a generally available feature: the `experimental_batching` router configuration option has been deprecated and is replaced by the `batching` option.

Previously, the router preserved the concept of a batch until a `RouterRequest` finished processing. From that point, the router converted each batch request item into a separate `SupergraphRequest`, and the router planned and executed those requests concurrently within the router, then reassembled them into a batch of `RouterResponse` to return to the client. Now with the implementation in this release, the concept of a batch is extended so that batches are issued to configured subgraphs (all or named). Each batch request item is planned and executed separately, but the queries issued to subgraphs are optimally assembled into batches which observe the query constraints of the various batch items.

To configure subgraph batching, you can enable `batching.subgraph.all` for all subgraphs. You can also enable batching per subgraph with `batching.subgraph.subgraphs.*`. For example:

```yaml
batching:
enabled: true
mode: batch_http_link
subgraph:
# Enable batching on all subgraphs
all:
enabled: true
```

```yaml
batching:
enabled: true
mode: batch_http_link
subgraph:
# Disable batching on all subgraphs
all:
enabled: false
# Configure(over-ride) batching support per subgraph
subgraphs:
subgraph_1:
enabled: true
subgraph_2:
enabled: true
```

Note: `all` may be over-ridden by `subgraphs`. This applies in general for all router subgraph configuration options.

To learn more, see [query batching in Apollo docs](https://www.apollographql.com/docs/router/executing-operations/query-batching/).

By [@garypen](https://github.com/garypen) in https://github.com/apollographql/router/pull/4661
5 changes: 2 additions & 3 deletions apollo-router/feature_discussions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
"experimental": {
"experimental_retry": "https://github.com/apollographql/router/discussions/2241",
"experimental_response_trace_id": "https://github.com/apollographql/router/discussions/2147",
"experimental_when_header": "https://github.com/apollographql/router/discussions/1961",
"experimental_batching": "https://github.com/apollographql/router/discussions/3840"
"experimental_when_header": "https://github.com/apollographql/router/discussions/1961"
},
"preview": {
"preview_entity_cache": "https://github.com/apollographql/router/discussions/4592"
}
}
}
Loading
Loading