jrasell / sherpa

Sherpa is a highly available, fast, and flexible horizontal job scaling for HashiCorp Nomad. It is capable of running in a number of different modes to suit different requirements, and can scale based on Nomad resource metrics or external sources.
Mozilla Public License 2.0
163 stars 8 forks source link

Discussion: External metric query comparison optimization #136

Open mylesw42 opened 4 years ago

mylesw42 commented 4 years ago

Is your feature request related to a problem? Please describe. In working with the external query providers, for a CPU/Memory scale-in/out check, the exact same query is executed twice with the current model.

I think Sherpa can execute the query once and then run it against multiple Action comparisons. I haven't looked to see how much of a change this would be, but I just wanted to propose the idea.

Describe the solution you'd like.

What if the external check model looked something like below?

{
  "Enabled": true,
  "MaxCount": 16,
  "MinCount": 2,
  "ScaleOutCount": 1,
  "ScaleInCount": 1,
  "ExternalChecks": {
    "check_name": {
      "Enabled": true,
      "Provider": "provider-type",
      "Query": "fancy provider metric query",
      "Actions": [
        {
          "ComparisonOperator": "less-than",
          "ComparisonValue": 30,
          "Action": "scale-in"
        },
        {
          "ComparisonOperator": "greater-than",
          "ComparisonValue": 80,
          "Action": "scale-out"
        }
      ]
    }
  }
}

Describe alternatives you've considered. N/A

Explain any additional use-cases. N/A

Additional context. N/A