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

boskos/janitor fails to clean up some resources in a timely manner if dirty rates are unequal #15925

Closed
ixdy opened this issue Jan 16, 2020 · 7 comments
Labels
area/boskos Issues or PRs related to code in /boskos kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@ixdy
Copy link
Member

ixdy commented Jan 16, 2020

Creating a one-sentence summary of this issue is hard, but the basic bug is fairly easy to understand.

Assume a Boskos instance has three resource types, A, B, and C. A has 5 resources, B has 10, and C has 100. A Boskos janitor has been configured to clean all three types.

Currently, the janitor loops through all resource types, iteratively cleaning one resource of each type. If the janitor finds that one of the types has no dirty resources, it stops querying that resource type until all resources have been cleaned, at which point it waits a minute and then starts over with the complete list again.

In our hypothetical case (as well as observed in practice), what this means is that the janitor will finish cleaning resources of type A (and possibly B), while still having many more C resources to clean. Additionally, given that C is such a large pool, there will likely be many jobs making more C resources dirty. As a result, it will be quite some time before the janitor attempts to clean A resources, and the pool will probably fill up with dirty resources.

Possible ways to mitigate the issue (in increasing complexity):

  • increase the number of janitor replicas
  • segment the janitors (i.e. have separate janitors for each type)
  • remove the optimization in the janitor loop, continuing to attempt to acquire all resource types (this will likely result in more /aquire RPCs to Boskos)
  • use Boskos metrics to select which resources to attempt to clean. This could even be prioritized (e.g. focus on whichever type is closest to running out of resources), though that might lead to different issues with starvation. Additionally, a failing cleanup could mean the janitor might get completely stuck.

/area boskos

@ixdy ixdy added the kind/bug Categorizes issue or PR as related to a bug. label Jan 16, 2020
@k8s-ci-robot k8s-ci-robot added the area/boskos Issues or PRs related to code in /boskos label Jan 16, 2020
@ixdy
Copy link
Member Author

ixdy commented Jan 28, 2020

Another example of how we can get into a bad state (which we're hitting today on one of our deployments): if a janitor is configured to clean many resource types, and one resource type is constantly failing to clean, all janitor replicas may eventually get stuck trying to clean up that resource type, to the exclusion of all others.

@stevekuznetsov
Copy link
Contributor

stevekuznetsov commented Jan 28, 2020

Couldn't we also change the janitor to run a watch on resources and use a workqueue/pool to handle resources? That should make better guarantees about QoS as well as record the number of failure attempts on a resource and give up on it at an acceptable time./

@ixdy
Copy link
Member Author

ixdy commented Jan 28, 2020

Probably. Currently the janitor interfaces through the Boskos HTTP API, but if we switch to just relying on the CRDs as the source of truth, we can probably make things scale more effectively.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 27, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 27, 2020
@ixdy
Copy link
Member Author

ixdy commented May 29, 2020

Moving to kubernetes-sigs/boskos#17.
/close

@k8s-ci-robot
Copy link
Contributor

@ixdy: Closing this issue.

In response to this:

Moving to kubernetes-sigs/boskos#17.
/close

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/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/boskos Issues or PRs related to code in /boskos kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

4 participants