Repository navigation
[Fusion] Let Apollo Federation lookups reuse entities instead of waiting for a third fetch wave - #10791
Merged
michaelstaib merged 3 commits intoNov 13, 2026
Conversation
…ing for a third fetch wave Identical Apollo entity lookups at different depths were folded into the deeper lookup, so a shallow lookup such as inventory for `topProducts` waited for nested lookups and ran as an extra fetch wave. When entity reuse can serve the deeper lookup, the lookups now stay apart and the deeper one runs after the shallower one, as composite lookups already do. Apollo nodes now write their ordering dependencies to the plan JSON and the parser restores them. Bumps OperationPlanner.Version to 2.8.0.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The round-trip test lacks coverage for batched or same-depth merged Apollo lookups with cross-batch dependencies, leaving optional ordering dependencies and required data prerequisites unverified.
1 open issue
What changed in this PR
This PR extends Fusion’s entity-reuse planning to Apollo Federation lookups, keeping reusable lookups at different depths separate to avoid an extra fetch wave.
Changes:
- Adds ordering dependencies between reusable Apollo lookups.
- Preserves those dependencies during plan JSON serialization and parsing without adding a new JSON property.
- Adds planning and round-trip tests, and disables reuse splitting in existing merge-policy tests.
| File | Description |
|---|---|
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/ApolloLookupMergePlanningTests.cs |
Disables reuse splitting to isolate existing merge behavior. |
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/ApolloEntityReuseSplittingTests.cs |
Tests lookup separation, dependency round-tripping, and disabled splitting. |
src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.BuildExecutionTree.cs |
Separates reusable Apollo lookups and classifies ordering dependencies. |
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/EntityReuseCandidateMap.cs |
Includes optional Apollo dependencies in reuse candidate discovery. |
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Serialization/JsonOperationPlanParser.cs |
Restores optional ordering dependencies for Apollo batch members. |
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Serialization/JsonOperationPlanFormatter.cs |
Writes Apollo ordering dependencies into the existing dependency arrays. |
Review effort: Balanced
Comment on lines
+560
to
+564
| || (groupNode is ApolloOperationBatchExecutionNode apolloGroup | ||
| && OperationPlanner.IsEntityReuseOrderingDependency( | ||
| apolloGroup, | ||
| memberIndex, | ||
| depNode, |
This was referenced Nov 13, 2026
Merged
This was referenced Nov 17, 2026
chore(deps): Bump HotChocolate.Subscriptions.InMemory from 16.7.5 to 16.7.7
Kuestenlogik/Bowire#1032
Merged
This was referenced Nov 23, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 43 others
AdCodicem/AdCodicem.ValueObjects#274
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

On Apollo Federation subgraphs, the planner folded identical entity lookups at different depths into the deeper one. So the inventory lookup for
topProductswaited for the nested product lookups and ran as a third fetch wave, about 4 ms per request in constant-latency mode. When entity reuse can serve the deeper lookup, the lookups now stay apart and the deeper one runs after the shallower one, which is what composite lookups already do. The nested lookup is then served from entities already in the result, so the Apollo gateway is within 1-2% of the composite gateway. Apollo nodes now write these ordering dependencies to the plan JSON and the parser restores them, using the existingdependenciesproperty, so the plan format is unchanged.Measured on a local copy of the benchmark (fusion-fed deep query, k6 with 50 VUs on pinned CPUs, inline socket settings, 4 ms subgraph delay in constant-latency mode, mean of two alternating 30 s rounds; CPU and min-latency rows are from constant-latency runs, and the composite gateway reaches 3,309 AOT and 3,324 JIT constant-latency req/s on the same machine).
OperationPlanner.Versionis bumped from 2.7.0 to 2.8.0, because affected Apollo plans now have a different shape.