Repository navigation
[Fusion] Fill fully reused entity lookups by row offset - #10657
Merged
Merged
Conversation
Apollo lookups now match targets against producers while the representations are written, instead of building throwaway variable value sets and writing the representations a second time. Add tests for both composite and Apollo lookups that cover batches where one or every operation is reused, two mutations that change the same entity, and subscription events that hold the same entity. Request counts and representations are checked with asserts, only responses use inline snapshots.
Contributor
Patch coverage85.6% of changed lines covered (370/432)
Uncovered changed lines (JSON){
"sha": "f145f066a80131e6c69bc714c1d98f8ce0e79c8c",
"files": [
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/EntityReuseCandidateMap.cs", "ranges": [[326, 327], [333, 334], [344, 345], [349, 350], [370, 371], [386, 387]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.Pooling.cs", "ranges": [[226, 229]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.cs", "ranges": [[897, 898], [909, 910], [983, 985], [991, 993], [1309, 1310], [1314, 1315], [1324, 1324], [1330, 1331], [1344, 1346], [1365, 1366], [1372, 1373], [1377, 1380], [1404, 1405], [1415, 1416], [1462, 1462], [1464, 1465], [1508, 1509], [1513, 1515]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/CompositeResultDocument.cs", "ranges": [[736, 737], [759, 762]] }
]
}Project coverage: 59.3% (314853/531207 lines) |
tobias-tengler
force-pushed
the
tte/entity-reuse-row-copy
branch
from
October 21, 2026 15:57
0372c9e to
5f99529
Compare
# Conflicts: # src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.RepresentationValue.cs
…e/entity-reuse-row-copy # Conflicts: # src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.Pooling.cs
…e/entity-reuse-row-copy
…e/entity-reuse-row-copy # Conflicts: # src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.RepresentationValue.cs # src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.cs
…e/entity-reuse-row-copy # Conflicts: # src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.RepresentationValue.cs # src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.cs
michaelstaib
marked this pull request as ready for review
October 22, 2026 12:45
michaelstaib
approved these changes
Oct 22, 2026
…copy # Conflicts: # src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.Pooling.cs # src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.RepresentationValue.cs # src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.cs
This was referenced Oct 25, 2026
Merged
This was referenced Nov 1, 2026
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.
Stacked on #10653, which adds request-scoped entity reuse to Apollo
_entitieslookups. This PR targets that branch and merges after it.A lookup whose entities are all satisfied by the request-scoped entity reuse from #10606 sends no request, but it still collects its targets and producers, writes the variable set JSON for both, and fills every reused field by response name.
The duplicate-target leaf copy from #10612 has the same cost: it resolves every completed leaf by response name for each duplicate target.
This PR matches reuse targets to producers on the raw bytes of their key values and fills the reused fields by row offset, so a fully reused lookup writes no JSON, no variable sets and no representations. The fast path covers composite lookups and Apollo
_entitieslookups (single and batched) alike; a fully reused Apollo lookup completes without writing a representation and its dependents run. The row offsets are resolved once per plan. If any target has no producer, or the keys are not simple leaf values, nothing is written and the existing path runs unchanged, which for Apollo is the partial reuse of #10653. The duplicate-target leaf copy now assigns leaves by row offset as well. Plans, request counts and results are unchanged.The numbers below were measured before the fast path was extended to Apollo lookups. They stand for the composite change; Apollo Federation was unchanged at that point because its plans had no entity reuse yet, so only the leaf copy applied. The Apollo extension has not been measured separately.
LookupFanOutBenchmark(added here) runs the whole benchmark query through the gateway executor against canned subgraph responses. Mean of two passes (order A B1 B2, then B2 B1 A),main= A, A1 = reuse fast path, A1+A2 = this PR.mainmaink6
constant, .NET 10, 30 s warm-up and 3 x 30 s, A B B A. Screen holds (composite hold 2, fed hold 1):mainmainConfirmation runs (one hold per cell, run CV in parentheses). Cells marked noisy have a run CV above 5% on at least one side and are not conclusive.
mainmainmainmainmainThe stable signal is allocation on composite: -4.7% to -5.3% KB/req in every pair. CPU/req is -4% to -6% in the clean cells (screen hold, constant B A, constant-latency); the noisy cells (constant A B, burst, Apollo Federation constant) show no pattern that can be attributed to the change and were not repeated cleanly. RPS does not move because the composite scenario is not gateway-bound at this load. Apollo Federation was unchanged in these runs: its plans had no entity reuse before #10653, so only the leaf copy applied and it is below the noise. Harness noise is about 3% RPS and 1.5% CPU/req for composite, 2% and 1% for Apollo Federation.