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

Add a configurable scale factor to scale in/out #13

Merged
merged 1 commit into from
May 5, 2019
Merged

Conversation

lox
Copy link
Contributor

@lox lox commented May 5, 2019

This adds a scale-in and scale-out factor that can be used to speed up or slow down scale outs and ins.

For instance, setting SCALE_IN_FACTOR=0.5 will reduce the change applied in each scale in by 50%. Setting SCALE_OUT_FACTOR=2.0 will increase each scale out change by 200%.

This is a simpler take on #12.

@lox
Copy link
Contributor Author

lox commented May 5, 2019

@etaoins would love to hear your thoughts!

Copy link
Contributor

@etaoins etaoins left a comment

Choose a reason for hiding this comment

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

Looks great and the implementation is pretty simple 🎉

return "", err
}
scaleInFactor = math.Abs(scaleInFactor)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice usability tweak 👍

scaler/scaler.go Show resolved Hide resolved
factoredChange := int64(math.Floor(float64(change) * factor))

if factoredChange < change {
log.Printf("👮‍️ Increasing scale-in of %d by factor of %0.2f",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about the utility of having a scale-in factor >100% but if someone is crazy enough to configure that I guess we should honour it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I thought the same 🤷🏼‍♂️

@lox lox merged commit 0b6685b into master May 5, 2019
@lox lox deleted the add-scale-factor branch May 5, 2019 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants