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

Azure: keep refreshes spread over time #3631

Merged
merged 1 commit into from
Oct 19, 2020

Conversation

bpineau
Copy link
Contributor

@bpineau bpineau commented Oct 19, 2020

When a vmssVmsCacheJitter is provided, API calls will be randomly spread (at startup time) over the provided time range, then happens at regular interval (for a given VMSS). This is meant to prevents API calls spikes.

But we noticed that the various VMSS' refreshes will progressively converge and agglomerate over time (in particular after a few large throttling windows affected the autoscaler), which defeats the purpose.

Re-randomizing the next refresh deadline every time (rather than just at autoscaler start) keeps the calls properly spread.
Configuring vmssVmsCacheJitter and vmssVmsCacheTTL allows users to control the average and worst case refresh interval (and avg API call rate). And we can count on VMSS size change detection to kick early refreshes when needed.

That's a small behaviour change, but possibly still a good time for that, as vmssVmsCacheJitter was introduced recently and wasn't part of any release yet.

This also slightly simplifies the code (no need to check if scaleSet.instancesRefreshJitter is > 0, if it is then lastRefresh will be time.Now().Add(0), so current time anyway).

An autoscaler instance running with "vmssVmsCacheJitter": 3540 a few days after start:

Cluster-Autoscaler Azure API calls_ vmss vm list (8)

Once patched:

Cluster-Autoscaler Azure API calls_ vmss vm list (9)

When a `vmssVmsCacheJitter` is provided, API calls (after start)
will be randomly spread over the provided time range, then happens
at regular interval (for a given VMSS). This prevents API calls
spikes.

But we noticed that the various VMSS' refreshes will progressively
converge and agglomerate over time (in particular after a few large
throttling windows affected the autoscaler), which defeats the
purpose.

Re-randomizing the next refresh deadline every time (rather than
just at autoscaler start) keeps the calls properly spread.
Configuring `vmssVmsCacheJitter` and `vmssVmsCacheTTL` allows users
to control the average and worst case refresh interval (and avg
API call rate). And we can count on VMSS size change detection
to kick early refreshes when needed.

That's a small behaviour change, but possibly still a good time
for that, as `vmssVmsCacheJitter` was introduced recently and
wasn't part of any release yet.
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 19, 2020
@nilo19
Copy link
Member

nilo19 commented Oct 19, 2020

/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 19, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bpineau, nilo19

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 19, 2020
@k8s-ci-robot k8s-ci-robot merged commit d054bb2 into kubernetes:master Oct 19, 2020
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants