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

Adjust watch channel sizes in watchcache #109708

Merged

Conversation

wojtek-t
Copy link
Member

Currently if there are types where we have very high churn (say leases in 5k-node clusters generate 500 QPS) for which we don't define trigger function in watchcache (so leases are the best example), we observe that re-instantiating watch may suffer from problems, because processing the init events may take more time than filling in the incomming channel.
This PR is switching the way those channels are initialized based on some heuristic around throughput of those objects.

/kind bug
/sig api-machinery
/priority important-longterm

NONE

/assign @mborsz @marseel

@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.24 branch. This means every merged PR has to be cherry-picked into the release branch to be part of the upcoming v1.24.0 release.

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Apr 28, 2022
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 28, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 area/apiserver approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 28, 2022

const (
// minWatchChanSize is the min size of channels used by the watch.
minWatchChanSize = 3
Copy link
Member

Choose a reason for hiding this comment

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

I would not change min size till we have proper tracking of terminating watchers in load test, WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm fine with blocking on perf-test change on that.

I wanted to change that, because technically we're risking increasing some of channels and wanted to compensate for that.

Copy link
Member

Choose a reason for hiding this comment

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

Issue created for it: kubernetes/perf-tests#2054

@wojtek-t
Copy link
Member Author

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 28, 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 Apr 28, 2022
@wojtek-t wojtek-t force-pushed the adjustable_watch_channel_size branch from 68d37ae to 0db5c05 Compare July 20, 2022 08:54
@wojtek-t
Copy link
Member Author

@marseel @mborsz - adjusted based on our discussions this morning; PTAL
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 20, 2022
@wojtek-t
Copy link
Member Author

/test pull-kubernetes-e2e-kind-ipv6

@marseel
Copy link
Member

marseel commented Jul 20, 2022

/retest

@mborsz
Copy link
Member

mborsz commented Jul 21, 2022

/lgtm

@mborsz
Copy link
Member

mborsz commented Jul 21, 2022

/retest

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 21, 2022
@k8s-ci-robot k8s-ci-robot merged commit 80c2a0f into kubernetes:master Jul 21, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.25 milestone Jul 21, 2022
@marseel
Copy link
Member

marseel commented Jul 26, 2022

FYI before we had some watches being terminated in scalability tests:

image

After merging this PR we don't have any terminated watchers 🎉 :
image

@wojtek-t
Copy link
Member Author

And we don't see visible change in memory usage - which is great.

chenchun pushed a commit to chenchun/kubernetes that referenced this pull request Mar 20, 2024
…!882)

1.20:移植社区启发式设置watch通道大小的特性,并支持通过env设置某些资源watch通道大小
1 51d81e2 移植 kubernetes#109708
把社区currentCapacity()中的写锁改成了读锁

2 8995bf4 增加RESOURCE_WATCH_CHAN_SIZE env,精细控制资源的watch通道大小
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/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. 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

5 participants