Skip to content

Revert "[Fusion] Stripe path segment pool per CPU core (#10025)"#10033

Merged
michaelstaib merged 1 commit into
mainfrom
revert/path-segment-pool-striping
Jul 2, 2026
Merged

Revert "[Fusion] Stripe path segment pool per CPU core (#10025)"#10033
michaelstaib merged 1 commit into
mainfrom
revert/path-segment-pool-striping

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

This reverts commit 24568fd.

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.
Copilot AI review requested due to automatic review settings July 2, 2026 07:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PathSegmentMemory with a single global pool and direct Rent/Return APIs.
  • Simplified PathSegmentLocalPool to 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;
}
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Patch coverage

74.5% of changed lines covered (41/55)

File Covered Changed Patch %
…/Fusion/src/Fusion.Execution/Text/Json/PathSegmentPool.cs 3 11 27.3% 🔴
…/Fusion/src/Fusion.Execution/Text/Json/PathSegmentMemory.cs 29 35 82.9% 🟡
…/Execution/Results/FetchResultStore.Pooling.cs 1 1 100.0% 🟢
…/src/Fusion.Execution/Text/Json/PathSegmentLocalPool.cs 8 8 100.0% 🟢
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)

@michaelstaib
michaelstaib merged commit 9f20d85 into main Jul 2, 2026
147 checks passed
@michaelstaib
michaelstaib deleted the revert/path-segment-pool-striping branch July 2, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants