Skip to content

Commit b367d82

Browse files
committed
Acceptable error rate for scale-down is a fraction
Increase test error rate to match
1 parent c189b70 commit b367d82

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/chunk/aws/metrics_autoscaling.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const (
2222
queueLengthScaledown = 10000 // consider scaling down if queue smaller than this
2323
queueLengthAcceptable = 100000 // we don't mind queues smaller than this
2424
queueLengthMax = 1000000 // always scale up if queue bigger than this
25-
errorRateScaledown = 1
25+
errorFractionScaledown = 0.1
2626
scaledown = 0.9
2727
scaleup = 1.2
2828
)
@@ -45,7 +45,7 @@ func (d dynamoTableClient) metricsAutoScale(ctx context.Context, current, expect
4545
level.Info(util.Logger).Log("msg", "checking metrics", "table", current.Name, "queueLengths", fmt.Sprint(m.queueLengths), "errorRate", errorRate)
4646

4747
switch {
48-
case m.queueLengths[2] < queueLengthScaledown && errorRate < errorRateScaledown:
48+
case m.queueLengths[2] < queueLengthScaledown && errorRate < errorFractionScaledown*float64(current.ProvisionedWrite):
4949
// No big queue, low errors -> scale down
5050
expected.ProvisionedWrite = int64(float64(current.ProvisionedWrite) * scaledown)
5151
level.Info(util.Logger).Log("msg", "metrics scale-down", "table", current.Name, "write", expected.ProvisionedWrite)

pkg/chunk/aws/metrics_autoscaling_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func TestTableManagerMetricsAutoScaling(t *testing.T) {
9292
staticTable(0, read, 233, read, 162)...), // - scale down both again
9393
)
9494

95-
mockProm.SetResponse(0, 0, 0, 1, 1, 1, 1)
95+
mockProm.SetResponse(0, 0, 0, 30, 30, 30, 30)
9696
test(t, client, tableManager, "Next week",
9797
startTime.Add(tablePeriod),
9898
// Nothing much happening - expect table 0 write rates to stay as-is and table 1 to be created with defaults
@@ -102,7 +102,7 @@ func TestTableManagerMetricsAutoScaling(t *testing.T) {
102102
)
103103

104104
// No errors on last week's index table, still some on chunk table
105-
mockProm.SetResponse(0, 0, 0, 0, 1, 1, 1)
105+
mockProm.SetResponse(0, 0, 0, 0, 30, 30, 30)
106106
test(t, client, tableManager, "Next week plus a bit",
107107
startTime.Add(tablePeriod).Add(time.Minute*10),
108108
append(append(baseTable("a", inactiveRead, inactiveWrite),

0 commit comments

Comments
 (0)