Skip to content

[Perf] Optimize and fix informer leak in core/bench benchmark tests#9668

Draft
tetianakh wants to merge 1 commit into
kubernetes:masterfrom
tetianakh:optimize-benchmark-tests
Draft

[Perf] Optimize and fix informer leak in core/bench benchmark tests#9668
tetianakh wants to merge 1 commit into
kubernetes:masterfrom
tetianakh:optimize-benchmark-tests

Conversation

@tetianakh
Copy link
Copy Markdown
Contributor

@tetianakh tetianakh commented May 19, 2026

What type of PR is this?

/kind bug
/kind regression

What this PR does / why we need it:

Speed up benchmarks:

  1. Introduce performance-optimized AddNodeDirect and AddPodDirect methods in fake Kubernetes client helper that bypass standard API-like Create serialization, deep-copy, and reactor overhead by writing directly to the object tracker.
  2. Leave existing AddNode and AddPod methods unchanged to ensure zero impact on existing integration tests.
  3. Pass a localized cancellable context to the Autoscaler builder per benchmark iteration and cancel it at the end of the iteration, resolving informer goroutine and cache leaks.
date && go test -v -bench=RunOnce -run=^$ -benchmem -count=6 -benchtime=1x ./core/bench/ > after-core.txt && date
Tue May 19 02:59:20 PM CEST 2026
Tue May 19 02:59:40 PM CEST 2026

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 19, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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.

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. kind/regression Categorizes issue or PR as related to a regression from a prior release. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 19, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

This issue is currently awaiting triage.

If SIG Autoscaling contributors 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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 19, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tetianakh
Once this PR has been reviewed and has the lgtm label, please assign bigdarkclown for approval. For more information see the Code Review Process.

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

Details 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. do-not-merge/needs-area Indicates that a PR should not merge because it lacks an area label. area/cluster-autoscaler Issues or PRs related to the Cluster Autoscaler component labels May 19, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @tetianakh. 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.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed do-not-merge/needs-area Indicates that a PR should not merge because it lacks an area label. labels May 19, 2026
1. Introduce performance-optimized AddNodeDirect and AddPodDirect methods in fake Kubernetes client helper that bypass standard API-like Create serialization, deep-copy, and reactor overhead by writing directly to the object tracker.
2. Leave existing AddNode and AddPod methods unchanged to ensure absolute zero regression impact on existing integration tests.
3. Pass a localized cancellable context to the Autoscaler builder per benchmark iteration and cancel it at the end of the iteration, resolving informer goroutine and cache leaks.
@tetianakh tetianakh force-pushed the optimize-benchmark-tests branch from e1252f8 to 5fc3afb Compare May 19, 2026 13:18
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 25, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cluster-autoscaler Issues or PRs related to the Cluster Autoscaler component cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. kind/regression Categorizes issue or PR as related to a regression from a prior release. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants