Revert "[Fusion] Stripe path segment pool per CPU core (#10025)"#10033
Merged
Conversation
This reverts commit 24568fd. The nightly constant-latency benchmark shows the striped pool as a net regression on the deep-recursion workload it was meant to optimize: +0.19 to +0.41 ms P50 and about -1.3% RPS versus the pre-striping baseline, with no offsetting reduction in gateway CPU per request. The round-robin stripe selection loses the LIFO cache warmth of the single pool, and at the benchmark topology (gateway pinned to 4 cores) the lock contention that striping relieves is not present. The separable improvements (batch return, trim fixes) can be reintroduced on the single pool in a follow-up.
Contributor
There was a problem hiding this comment.
Pull request overview
Reverts the previously introduced “striped per-CPU-core” path segment pooling in Fusion by returning to a single global PathSegmentPool, simplifying pool selection and related diagnostics while removing the tests that were added for the striped implementation.
Changes:
- Replaced striped pool selection logic in
PathSegmentMemorywith a single global pool and directRent/ReturnAPIs. - Simplified
PathSegmentLocalPoolto use the global pool (and removed the batch-return path), and updated call sites accordingly. - Removed stripe-focused unit tests and simplified benchmark diagnostics output.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Text/Json/PathSegmentPoolTests.cs | Removes tests that validated pool caching, batch return semantics, and trimming behavior. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Text/Json/PathSegmentMemoryTests.cs | Removes tests covering stripe level division and pool index selection logic. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Text/Json/PathSegmentLocalPoolTests.cs | Removes tests for cross-thread disposal, idempotent disposal, and allocation bounds. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/PathSegmentPool.cs | Reverts constructor/bucket behavior (notably removing batch return) and adjusts trimming timer behavior. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/PathSegmentMemory.cs | Reverts from striped pools to a single global pool and updates the public surface accordingly. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/PathSegmentLocalPool.cs | Switches local pool to global PathSegmentMemory and replaces batch return with per-item returns. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.Pooling.cs | Updates initialization to construct PathSegmentLocalPool without passing a selected stripe pool. |
| src/HotChocolate/Fusion/benchmarks/k6/eShop.Gateway/PathSegmentPoolDiagnostics.cs | Simplifies diagnostics aggregation from “per stripe” to single-pool metrics. |
| .gitignore | Stops ignoring .perf. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| return; | ||
| } | ||
| _currentLevel = previousLevel; |
Comment on lines
+45
to
+47
| public static int[] Rent() => s_pool.Rent(); | ||
|
|
||
| /// <summary> | ||
| /// Divides the base capacity ladder by <paramref name="count"/> so the total cache size across | ||
| /// all stripes stays close to the single-pool sizing. Levels that do not grow after division are | ||
| /// dropped so the returned ladder is strictly increasing for any stripe count; the top capacity | ||
| /// is always preserved. | ||
| /// </summary> | ||
| internal static int[] DivideLevels(ReadOnlySpan<int> baseLevels, int count) | ||
| { | ||
| var levels = new int[baseLevels.Length]; | ||
| var length = 0; | ||
| var previous = 0; | ||
|
|
||
| for (var i = 0; i < baseLevels.Length; i++) | ||
| { | ||
| var level = Math.Max(32, baseLevels[i] / count); | ||
|
|
||
| // Equal adjacent levels defeat the bucket's level ladder, so only keep a level once it | ||
| // grows past the previous one. Plateaus at the top carry the same capacity forward. | ||
| if (level > previous) | ||
| { | ||
| levels[length++] = level; | ||
| previous = level; | ||
| } | ||
| } | ||
|
|
||
| return levels.AsSpan(0, length).ToArray(); | ||
| } | ||
| public static void Return(int[] array) => s_pool.Return(array); |
Comment on lines
+87
to
+91
| for (var i = 0; i < _allRentedCount; i++) | ||
| { | ||
| PathSegmentMemory.Return(_allRented[i]!); | ||
| _allRented[i] = null; | ||
| } |
Contributor
Patch coverage74.5% of changed lines covered (41/55)
Uncovered changed lines (JSON){
"sha": "0374b9be489f20381b9df944975ae90588315725",
"files": [
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/PathSegmentPool.cs", "ranges": [[214, 214], [216, 216], [218, 218], [221, 222], [224, 224], [236, 236], [260, 260]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/PathSegmentMemory.cs", "ranges": [[36, 36], [38, 42]] }
]
}Project coverage: 52.5% (217051/413246 lines) |
This was referenced Jul 7, 2026
This was referenced Jul 14, 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.
This reverts commit 24568fd.