github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/autoscaling/plugins/strategy.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: Strategy
     4  sidebar_title: Strategy
     5  description: Strategy plugins compare the current state of the system against the desired state.
     6  ---
     7  
     8  # Strategy Plugins
     9  
    10  Strategy plugins compare the current state of the system against the desired state
    11  defined by the operator in the scaling policy and generate an action that will
    12  bring the system closer to the desired state. In practical terms, strategies
    13  receive the current value and a metric value for a resource and output what the
    14  new value should be.
    15  
    16  ## Target Value Strategy Plugin
    17  
    18  The target value strategy plugin will perform count calculations in order to keep
    19  the value resulting from the APM query at or around a specified target.
    20  
    21  ### Agent Configuration Options
    22  
    23  ```hcl
    24  strategy "target-value" {
    25    driver = "target-value"
    26  }
    27  ```
    28  
    29  ### Policy Configuration Options
    30  
    31  ```hcl
    32  check {
    33    ...
    34    strategy "target-value" {
    35      target    = 20
    36      threshold = 0.0001
    37    }
    38    ...
    39  ```
    40  
    41  - `target` `(float: <required>)` - Specifies the metric value the Autoscaler
    42    should try to meet.
    43  
    44  - `threshold` `(float: 0.01)` - Specifies how significant a change in the input
    45    metric should be considered. Small threshold values can lead to output
    46    fluctuation.
    47  
    48  ## Dynamic Application Sizing Average Strategy Plugin
    49  
    50  <EnterpriseAlert>
    51  This functionality only exists in Nomad Autoscaler
    52  Enterprise. This is not present in the open source version of Nomad Autoscaler.
    53  </EnterpriseAlert>
    54  
    55  The `app-sizing-avg` plugin calculates the average value seen across the dataset.
    56  The plugin applies an exponential weight decay to data, in order to give
    57  more significance to recent data over older data.
    58  
    59  This plugin is only recommended for CPU values of workloads with very stable
    60  resource usage levels, such as batch jobs.
    61  
    62  ### Agent Configuration Options
    63  
    64  The `app-sizing-avg` plugin is automatically launched by Nomad Autoscaler
    65  Enterprise and so the following setup is optional.
    66  
    67  ```hcl
    68  strategy "app-sizing-avg" {
    69    driver = "app-sizing-avg"
    70  }
    71  ```
    72  
    73  ### Policy Configuration Options
    74  
    75  ```hcl
    76  check "avg" {
    77    strategy "app-sizing-avg" {}
    78  }
    79  ```
    80  
    81  ## Dynamic Application Sizing Max Strategy Plugin
    82  
    83  <EnterpriseAlert>
    84  This functionality only exists in Nomad Autoscaler
    85  Enterprise. This is not present in the open source version of Nomad Autoscaler.
    86  </EnterpriseAlert>
    87  
    88  The `app-sizing-max` plugin calculates the maximum value seen for the target
    89  resource within the available dataset. This plugin is ideally suited for memory
    90  resources since workloads don’t release their memory too often and
    91  underprovisioning could cause OOM errors.
    92  
    93  ### Agent Configuration Options
    94  
    95  The `app-sizing-max` plugin is automatically launched by Nomad Autoscaler
    96  Enterprise and so the following setup is optional.
    97  
    98  ```hcl
    99  strategy "app-sizing-max" {
   100    driver = "app-sizing-max"
   101  }
   102  ```
   103  
   104  ### Policy Configuration Options
   105  
   106  ```hcl
   107  check "max" {
   108    strategy "app-sizing-max" {}
   109  }
   110  ```
   111  
   112  ## Dynamic Application Sizing Percentile Strategy Plugin
   113  
   114  <EnterpriseAlert>
   115  This functionality only exists in Nomad Autoscaler
   116  Enterprise. This is not present in the open source version of Nomad Autoscaler.
   117  </EnterpriseAlert>
   118  
   119  The `app-sizing-percentile` plugin calculates its result based on a desired
   120  percentile value from the dataset.
   121  
   122  The plugin applies an exponential weight decay to data, in order to give
   123  more significance to recent data over older data. It also adjusts its calculation
   124  based on the amount of resources used per unit of time. This load-adjusted
   125  calculation results in values that are more likely to actually meet the usage
   126  needs of the workload when compared to the traditional time-based percentile
   127  calculation.
   128  
   129  This Dynamic Application Sizing plugin is the most versatile, since the percentile
   130  level can be fine-tuned as needed. If your workload can withstand occasional OOM
   131  errors gracefully, using a 98th percentile for memory instead of app-sizing-max
   132  could result in smaller recommendations and subsequently more resource availability
   133  for other tasks. A 95th to 90th percentile for CPU could have the same effect.
   134  
   135  ### Agent Configuration Options
   136  
   137  The `app-sizing-percentile` plugin is automatically launched by Nomad Autoscaler
   138  Enterprise and so the following setup is optional.
   139  
   140  ```hcl
   141  strategy "target-value" {
   142    driver = "target-value"
   143  }
   144  ```
   145  
   146  ### Policy Configuration Options
   147  
   148  ```hcl
   149  check "p95" {
   150    strategy "app-sizing-percentile" {
   151      percentile = "95"
   152    }
   153  }
   154  ```
   155  
   156  - `percentile` `(int: 99)` - Specifies the percentile value to use when performing
   157    the strategy calculation.