Skip to content

Conversation

LukeAVanDrie
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This PR refactors the flow control dispatch cycle to align with a recent change to the SaturationDetector contract (in #1293), which moved from a pool-wide saturation signal to a per-request signal.

The core change removes the previous BandFilter abstraction and implements a post-selection viability check. The dispatcher now first allows the inter-flow (fairness) and intra-flow (ordering) policies to select the single best request. Only then is the SaturationDetector consulted to see if that specific request is viable.

This new logic strictly enforces the policy decisions. For example, given two flows:

  • A: [A_1, A_2, ...]
  • B: [B_1, B_2, ...]

If policies select A_1 as the next item to dispatch, but it targets saturated backends, the dispatcher will now block the entire priority band for the current cycle. It will not attempt to dispatch B_1 or A_2. This introduces a known trade-off between strict fairness and work conservation (the "noisy neighbor" problem). This is a reasonable default, and future work can explore giving operators more control over this behavior.

Which issue(s) this PR fixes:

Tracks #674.

Does this PR introduce a user-facing change?:

NONE

This commit refactors the flow control `ShardProcessor` to align with
the new `SaturationDetector` contract (introduced in 7d84fb9), which
evaluates saturation for a specific set of candidate pods rather than
for the entire pool.

This change fundamentally alters the dispatching logic to prioritize
strict fairness and priority over work conservation.

The `BandFilter` abstraction has been removed, and the `ShardProcessor`
now performs a post-selection viability check. After policies select
the fairest request, the `SaturationDetector` is called with the
candidate pods for only that specific request. If the check fails, the
processor stops the entire dispatch cycle for the current tick,
enforcing Head-of-Line blocking to prevent priority inversion.

This new model correctly upholds a strict fairness and priority
contract. However, it introduces a known trade-off where the system may
leave resources idle if the fairest request is blocked, rather than
finding other viable work (the "noisy neighbor" problem).
Copy link

netlify bot commented Sep 19, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit eb4aca2
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/68cdec375d1c5600086a5659
😎 Deploy Preview https://deploy-preview-1622--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 19, 2025
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 19, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @LukeAVanDrie. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 19, 2025
@ahg-g
Copy link
Contributor

ahg-g commented Sep 20, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 20, 2025
@ahg-g
Copy link
Contributor

ahg-g commented Sep 20, 2025

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 20, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, LukeAVanDrie

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 20, 2025
@LukeAVanDrie
Copy link
Contributor Author

@kaushikmitr and @BenjaminBraunDev FYI

This prepares us for per-request saturation. The solution isn't elegant right now but I am working on a proposal to give operators control over the work-conservation / strict fairness tradeoff during HoL blocking.

@k8s-ci-robot k8s-ci-robot merged commit 3211b34 into kubernetes-sigs:main Sep 20, 2025
11 checks passed
@LukeAVanDrie LukeAVanDrie deleted the refactor/flow-control-saturation-check branch September 20, 2025 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants