perf: introduce stopChurn opcode in scheduler_perf framework #139441
This issue is currently awaiting triage.
If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.
The triage/accepted label can be added by org members by writing /triage accepted in a comment.
<details>
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.
</details>
Hi @GFilipek. Thanks for your PR.
I'm waiting for a kubernetes 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.
>[!TIP]
>We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.
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.
<details>
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.
</details>
/assign iomarsayed
/ok-to-test
What if a test author specifies a non-empty name in stopChurn, but no active churn exists with that name? I think this case silently fails and returns nil. Is that expected?
Wouldn't it be probably better to fail the test, telling the author about that?
Maybe?
// Name of the churn operation to stop. Optional.
// If empty, stopChurnOp stops all background churns.
I have only a couple of comments.
done.
done.
/lgtm
LGTM label has been added. <details>Git tree hash: 37ab6efd730ee4413444bbd9135432cc9127622d</details>
/assign dom4ha
The code itself looks generally good, but is there an issue or similar where the introduction of this opcode is being discussed?
The code itself looks generally good, but is there an issue or similar where the introduction of this opcode is being discussed?
This is related to gang scheduling testing and reproducing the problem described in #138249 We need this op to reproduce high churn scenario with unschedulable pods - working on it in #139421
These tests aim to 1. show that podgroups are less likely to starve scheduler queue and 2. verify if we do not have any regressions in scheduling both individual pods and podgoups in high churn scenarios that would cause this problem manifesting more often
> The code itself looks generally good, but is there an issue or similar where the introduction of this opcode is being discussed?
> This is related to gang scheduling testing and reproducing the problem described in #138249 We need this op to reproduce high churn scenario with unschedulable pods - working on it in #139421 These tests aim to 1. show that podgroups are less likely to starve scheduler queue and 2. verify if we do not have any regressions in scheduling both individual pods and podgoups in high churn scenarios that would cause this problem manifesting more often
Is it a good example? In those tests, the stopChurn is executed at the end of the test case. How does the stopChurn operation help there?
Is it a good example? In those tests, thestopChurnis executed at the end of the test case. How does thestopChurnoperation help there?
Without the stop churn, test may fail on check if there are inflight events in the queue here - unchedulable pods are still processed while the measured pods are done and test wants to exit.
> Is it a good example? In those tests, thestopChurnis executed at the end of the test case. How does thestopChurnoperation help there?
> Without the stop churn, test may fail on check if there are inflight events in the queue here - unchedulable pods are still processed while the measured pods are done and test wants to exit.
So, shouldn't the churn operation be auto-stopped on the test teardown instead?
New changes are detected. LGTM label has been removed.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: <a href="https://github.com/kubernetes/kubernetes/pull/139441#" title="Author self-approved">GFilipek</a>
Once this PR has been reviewed and has the lgtm label, please ask for approval from dom4ha. For more information see the Code Review Process.
The full list of commands accepted by this bot can be found here.
<details open>
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
</details>
<!-- META={"approvers":["dom4ha"]} -->
So, shouldn't the churn operation be auto-stopped on the test teardown instead?
Yes, for now this would be sufficient. I've split the PR into 2 commits - stopping churn and adding new opcode - I can revert the second one if you think stop opcode is not useful.
/test pull-kubernetes-e2e-gce
/test pull-kubernetes-node-e2e-containerd
> So, shouldn't the churn operation be auto-stopped on the test teardown instead?
> Yes, for now this would be sufficient. I've split the PR into 2 commits - stopping churn and adding new opcode - I can revert the second one if you think stop opcode is not useful.
If you see any immediate use case for stopChurn op, I'm okay to merge it. If you think it will be useful in the future, but won't be needed soon, let's add it later.
Shouldn't we use defer to cover all exit scenarios?
Once we do that, don't we need to add mutex around churnCancels?
+1 to @macsko, let's skip the new op if it's not needed now.
I will park this PR for now, the background churn is already properly closed by context cancelation here on workflow exit so no need to add separate context if we do not want to cancel them on demand.
The errors I was seeing were probably artifacts of bad scheduler cancelation which was fixed in #139323
PR needs rebase.
<details>
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.
</details>
iomarsayed
GFilipek
<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://git.k8s.io/community/contributors/guide/first-contribution.md#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request. For reference on required PR/issue labels, read here:
https://git.k8s.io/community/contributors/devel/sig-release/release.md#issuepr-kind-label
3. Ensure you have added or ran the appropriate tests for your PR: https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
4. If you want faster PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
5. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
-->
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR introduces a new
stopChurnopcode to thescheduler_perfintegration testing framework with support for tracking and stopping multiple concurrent churn generators.Currently, the
churnopcode starts a background churn generator (creating/deleting pods) that runs for the entire remaining lifetime of the workload run. There is no mechanism to stop a background churn loop in the middle of a workload template sequence, nor is there support for managing multiple concurrent/overlapping churn generators without resource leaks.To resolve this, this PR:
1. Adds an optional
Namefield to both thechurnandstopChurnopcodes.2. Updates
WorkloadExecutorto track background churn cancellation functions in a map (churnCancels) indexed by their name.3. Implements named and multi-cancellation logic in
runStopChurnOp:- Named Cancellation: If a
Nameis specified, it cancels and cleans up only that specific background churn generator.- Bulk Cancellation: If no
Nameis specified, it cancels and cleans up all currently active background churn generators.4. Includes comprehensive unit tests (
TestStopChurnOpCancellation) verifying correct cancellation and map state tracking for both scenarios.Which issue(s) this PR is related to:
N/A
Special notes for your reviewer:
This is a prerequisite framework change needed for subsequent scheduler performance/starvation benchmark tests that utilize the
stopChurnopcode. The starvation performance tests themselves are introduced in #139421.Does this PR introduce a user-facing change?
``
release-note
``NONE
docs
NONE