Skip to content

removed datastore dependency from saturation detector #1293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nirrozenbaum
Copy link
Contributor

@nirrozenbaum nirrozenbaum commented Aug 4, 2025

This PR aims to improve the request handling flow.
Before this PR the flow is:

  • director gets an incoming request. could be with subset filtering (only subset of the endpoints are candidates to serve the request)
  • saturation detector runs for all pods always, even if subset filtering was specified. as part of this code, saturation detection gets all pods from datastore.
  • director goes again to datastore to get candidate pods for scheduling while considering the subset filter header.
  • schedule
  • ....
    in this flow pods are read from the datastore twice in a row, and saturation check is done for all the pods even if subset filter was specified.

After this PR:

  • director gets an incoming request. could be with subset filtering (only subset of the endpoints are candidates to serve the request).
  • director goes to datastore to get candidate pods for scheduling while considering the subset filter header.
  • saturation detector runs only for the candidate pods for scheduling. it gets as input the candidate pods. no need to have datastore as a dependency in saturation detector.
  • if candidate pods are not saturated, continue to schedule
  • ...
    in this flow pods are read from the datastore once for the request flow and saturation check is done only for the relevant pods for the request.

tests updated accordingly.

Additionally, this PR removes the extensive documentation in some places. IMO we don't want to document every function internal step. this is not maintainable. the code should be self explainable (which it is!) in a way that doesn't require this extensive documentation. for example, in HandleRequestion function (inside director), there is no need to explain in the godoc what are the steps. one can just read the function and easily understand the steps.

cc: @kfswain @LukeAVanDrie

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nirrozenbaum

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 requested review from ahg-g and liu-cong August 4, 2025 12:22
@k8s-ci-robot k8s-ci-robot added 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 4, 2025
Copy link

netlify bot commented Aug 4, 2025

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

Name Link
🔨 Latest commit 728fe9a
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/6895069353b5cb000832a7c0
😎 Deploy Preview https://deploy-preview-1293--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.

result, err := d.scheduler.Schedule(ctx, reqCtx.SchedulingRequest, candidatePods)

// Admission Control check
if err := d.admitRequest(ctx, candidatePods, requestCriticality, reqCtx.FairnessID); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could move admiRequest logic into getCandidatePodsForScheduling. Intuitively, the admiRequest function should be called before the getCandidatePodsForScheduling function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the main logic currently in admitReqeust is to check saturation of the system.
it's not relevant to check saturation of all the pods but only of the candidate pods (If we use subset filtering to specify list of pods and all of them are saturated, it's not helpful that other pods are available).

therefore, getCandidatePods is done before the admitRequest function.

think about it this way -
getCandidatePods func returns the set of pods that are relevant for current request.
admitRequest func check if any of the pods from the above set can actually serve the request, or if all of them are saturated.

@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 9, 2025
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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants