Multiple Autoscaler threshold strategies never scale in

Hey all! Please tell me if I’m wrong here, but I can’t see a reason why the Nomad Autoscaler would scale in if there’s two or more threshold strategies in the same policy.

For example, let’s use the policy below which I took from the threshold documentation.

policy {
  # ...
  check "high-memory-usage" {
    # ...
    strategy "threshold" {
      upper_bound = 100
      lower_bound = 70
      delta       = 1
    }
  }

  check "low-memory-traffic" {
    # ...
    strategy "threshold" {
      upper_bound = 30
      lower_bound = 0
      delta       = -1
    }
  }
  # ...
}

Let’s assume the metric value we have is 20. That means the low-memory-traffic check would return ScaleIn, as expected. However, since 20 is outside the threshold bounds of the high-memory-usage check, it would return ScaleNone. And because the Autoscaler chooses results that retain the most capacity (ScaleIn and ScaleNone => ScaleNone), this policy will evaluate to ScaleNone.

I can’t think of any non-overlapping combinations of threshold strategies that would ever return ScaleIn. Am I missing something here? Thanks for listen. I’ve been racking my brain on this a bit.

I’m experiencing a similar mal-behavior. Has anybody found a workaround?

EDIT: This Pull Request suggests adding a group to similar checks. I haven’t gotten it to work with the “nomad” data source, but it might work for some people.

1 Like

Hi all :wave:

Sorry for the late reply, yes @pop that PR should fix the problem, I’m still working on the detailed docs but you should be able to set the checks that use the same metric source to the same group value.

It shouldn’t matter what data source is being used though. Would you mind sharing how your policy looks like?

Thanks!