Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add a cache for what resource types are scalable so not every reconcile has to do a GET to the /scale endpoint #1453

Merged
merged 2 commits into from
Jan 4, 2021

Conversation

coderanger
Copy link
Contributor

@coderanger coderanger commented Dec 26, 2020

Adds an in-memory cache to speed up reconciles. With large numbers of scaled objects I'm seeing a ton a request throttling (#1449) that I think (but won't be sure until I try deploying this and seeing if it goes away) is related to these scale requests on every reconcile. The better solution would be for controller-runtime to support access to the scale subresource (kubernetes-sigs/controller-runtime#172) so these requests could hit the local informer cache or something, but that's got a lot of problems itself so I think this solution is a good step for now.

Checklist

  • Commits are signed with Developer Certificate of Origin (DCO)
  • Tests have been added
  • Changelog has been updated

…oint, even when the data isn't needed.

Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
@coderanger
Copy link
Contributor Author

This did reduce the rate of "Throttling request" warnings but not all of them.

Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
@coderanger coderanger changed the title Add a cache so not every reconcile has to do a GET to the /scale endpoint Add a cache for what resource types are scalable so not every reconcile has to do a GET to the /scale endpoint Dec 28, 2020
Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

LGTM

@zroubalik
Copy link
Member

The better solution would be for controller-runtime to support access to the scale subresource (kubernetes-sigs/controller-runtime#172) so these requests could hit the local informer cache or something

Yeah that would definitely help, lack of support of this in controller-runtime' is the reason why we need access the /scale` subresource this way, but didn't know that it will not hit the cache.

Thanks for the fix!

@zroubalik zroubalik merged commit 5819a1f into kedacore:main Jan 4, 2021
@coderanger coderanger deleted the scalable-cache branch January 4, 2021 20:29
ycabrer pushed a commit to ycabrer/keda that referenced this pull request Mar 1, 2021
…le has to do a GET to the /scale endpoint (kedacore#1453)

* Add a cache so not every reconcile has to do a GET to the /scale endpoint, even when the data isn't needed.

Signed-off-by: Noah Kantrowitz <noah@coderanger.net>

* Add statefulsets to the prefill list too. 

Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants