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

🐛 quota: use a workqueue to manage updating monitors #2270

Merged

Conversation

stevekuznetsov
Copy link
Contributor

When there's a lot of churn in the types contained in kcp, the type-aware shared informer factory will be sending out a lot of notifications in a short window of time. The previous implementation used a single goroutine to consume the notifications, therefore restricting the allowed production throughput to the consumption throughput, leading to notifications being lost.

In order to be more resilient to this type of situation, we need to decouple consumption from production, and while we're doing that we do not want to hold on to a large number of pending notifications, nor do we want to duplicate work when many notifications are received during the handling of the first.

As the monitor update is idempotent, but not reentrant, we can utilize a workqueue with one worker to ensure that handling on the consumption is single-threaded, while de-duplicating notifications that occur while monitor updates are in flight.

Signed-off-by: Steve Kuznetsov skuznets@redhat.com

/assign @ncdc

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 26, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 26, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ncdc

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 26, 2022
When there's a lot of churn in the types contained in `kcp`, the
type-aware shared informer factory will be sending out a lot of
notifications in a short window of time. The previous implementation
used a single goroutine to consume the notifications, therefore
restricting the allowed production throughput to the consumption
throughput, leading to notifications being lost.

In order to be more resilient to this type of situation, we need to
decouple consumption from production, and while we're doing that we do
not want to hold on to a large number of pending notifications, nor do
we want to duplicate work when many notifications are received during
the handling of the first.

As the monitor update is idempotent, but not reentrant, we can utilize a
workqueue with one worker to ensure that handling on the consumption is
single-threaded, while de-duplicating notifications that occur while
monitor updates are in flight.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 27, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 27, 2022

New changes are detected. LGTM label has been removed.

@stevekuznetsov stevekuznetsov added the lgtm Indicates that a PR is ready to be merged. label Oct 27, 2022
@stevekuznetsov
Copy link
Contributor Author

Just ran gofmt on the file, pushed.

@openshift-merge-robot openshift-merge-robot merged commit 551b2c9 into kcp-dev:main Oct 27, 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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants