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

Snap to non-fractioned scaling boundaries #60

Merged
merged 6 commits into from
May 7, 2019
Merged

Conversation

otrosien
Copy link
Member

@otrosien otrosien commented May 5, 2019

Fixes #59

operator/autoscaler.go Outdated Show resolved Hide resolved
Signed-off-by: Oliver Trosien <[email protected]>
Signed-off-by: Oliver Trosien <[email protected]>
Signed-off-by: Oliver Trosien <[email protected]>
@njuettner
Copy link
Contributor

👍

@@ -293,7 +293,9 @@ func (as *AutoScaler) scaleUpOrDown(esIndices map[string]ESIndex, scalingHint Sc
}
}

newDesiredNodeReplicas := as.ensureUpperBoundNodeReplicas(scalingSpec, int32(math.Ceil(float64(currentTotalShards)/float64(currentShardToNodeRatio-1))))
// round down to the next non-fractioned shard-to-node ratio
newShardToNodeRatio := math.Ceil(float64(currentTotalShards) / math.Floor(currentShardToNodeRatio-0.00001))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems a little hacky, what is the reason for this particular fraction? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

just getting the code to round down. Too much magic? Shall I extract this into a private method and add more tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

I added more tests... WDYT?

Signed-off-by: Oliver Trosien <[email protected]>
Signed-off-by: Oliver Trosien <[email protected]>
@otrosien
Copy link
Member Author

otrosien commented May 6, 2019

👍

@otrosien
Copy link
Member Author

otrosien commented May 6, 2019

adressed some of the review comments.

@otrosien otrosien requested a review from mikkeloscar May 6, 2019 14:22
@otrosien otrosien added this to the v0.2.0 milestone May 6, 2019
@njuettner
Copy link
Contributor

👍

@otrosien otrosien merged commit 5cb98e2 into master May 7, 2019
@otrosien otrosien deleted the non-fractioned-scaling branch May 7, 2019 12:36
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.

Snap scaling among non-fractioned shard-to-node ratios
4 participants