Skip to content
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

Add benchmark for json.compact high cpu usage in watch #113326

Merged
merged 1 commit into from Oct 28, 2022

Conversation

mborsz
Copy link
Member

@mborsz mborsz commented Oct 25, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:

Adds repro benchmark for #110146

It also does tiny refactor of existing benchmark, with no performance diff:

name               old time/op  new time/op  delta
WatchHTTP-48       31.5µs ± 0%  33.3µs ± 0%   ~     (p=1.000 n=1+1)
WatchHTTP_UTF8-48  31.9µs ± 0%  32.5µs ± 0%   ~     (p=1.000 n=1+1)
WatchWebsocket-48  32.9µs ± 0%  32.2µs ± 0%   ~     (p=1.000 n=1+1)
WatchProtobuf-48   18.6µs ± 0%  18.9µs ± 0%   ~     (p=1.000 n=1+1)

BenchmarkWatchCachingObjectJSON properly reproduces #110146:
image

Such branch isn't visible for BenchmarkWatchCachingObjectProtobuf:
image

Special notes for your reviewer:

It makes CachingObject public so that we can reuse it for performance testing. Alternative approach would be to reimplement some simpler mock, if prefered.

Does this PR introduce a user-facing change?

NONE

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


/assign @wojtek-t (for comments on making CachingObject public)

Wojtek, is it OK to make this public or we prefer to implement fakeCachingObject in the watch_test.go?

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 25, 2022
@k8s-ci-robot k8s-ci-robot added area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 25, 2022
@mborsz
Copy link
Member Author

mborsz commented Oct 25, 2022

/retest

@mborsz
Copy link
Member Author

mborsz commented Oct 26, 2022

/assign @lavalamp as Wojtek is OOO

Copy link
Contributor

@stevekuznetsov stevekuznetsov left a comment

Choose a reason for hiding this comment

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

Benchmark refactors here look good.

/lgtm

@@ -878,7 +879,7 @@ func BenchmarkWatchHTTP(b *testing.B) {
item.Name = fmt.Sprintf("reasonable-name-%d", i)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: self-links were removed, may or may not be useful to remove these, perhaps in some follow-up

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 26, 2022
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 27, 2022
@mborsz
Copy link
Member Author

mborsz commented Oct 27, 2022

/retest

@wojtek-t
Copy link
Member

This looks great now - thanks @mborsz !

/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 Oct 27, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mborsz, wojtek-t

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 Oct 27, 2022
@leilajal
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 27, 2022
@pacoxu
Copy link
Member

pacoxu commented Oct 28, 2022

/retest
for flake Test_Run_OneVolumeDetachFailNodeWithReadWriteOnce

@k8s-ci-robot k8s-ci-robot merged commit 08644a1 into kubernetes:master Oct 28, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Oct 28, 2022
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. area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants