github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/tools/autoscaling/concepts/policy-eval/node-selector-strategy.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: Node Selector Strategy
     4  description: Learn about the Autoscaler's node selection strategies.
     5  ---
     6  
     7  # Node Selector Strategy
     8  
     9  The node selector strategy is a mechanism the Nomad Autoscaler uses to identify
    10  nodes for termination when performing horizontal cluster scale-in actions. It
    11  is exposed as a target configuration option so that operators can modify its
    12  behaviour based on requirements.
    13  
    14  ### `least_busy` Node Selector Strategy
    15  
    16  The `least_busy` strategy is the default node selector strategy used if the
    17  `node_selector_strategy` configuration option is omitted. When used, the Nomad
    18  Autoscaler will sort nodes based on their overall CPU and memory allocation;
    19  picking those with the lowest values. In the event a number of nodes have the
    20  same allocated percentage value, the selection will be random according to Golang's
    21  sort implementation.
    22  
    23  The `least_busy` strategy suits workloads that can tolerate migrations but
    24  allows you to minimise such events.
    25  
    26  ### `empty` Node Selector Strategy
    27  
    28  The `empty` strategy will only consider nodes eligible for termination if they
    29  have zero non-terminal allocations. The terminal status of an allocation is
    30  determined using [these Nomad SDK allocation functions][nomad_api_terminal_alloc].
    31  The strategy will skip any node that does not meet this requirement. This can
    32  result in scaling actions terminating a smaller number of nodes than desired. In
    33  the event no nodes are found to be empty, the Nomad Autoscaler will decline to
    34  perform the scaling action.
    35  
    36  The `empty` strategy is ideal for batch workloads, ensuring allocations are not
    37  interrupted by scaling.
    38  
    39  ~> **Note:** [system][system_scheduler] jobs will prevent this strategy from
    40  scaling-in nodes. Please use the [`empty_ignore_system`](#empty_ignore_system)
    41  strategy if you have system jobs in your cluster.
    42  
    43  ### `empty_ignore_system` Node Selector Strategy
    44  
    45  The `empty_ignore_system` strategy is similar to `empty`, but it will not
    46  consider allocations from [system][system_scheduler] jobs. A node with only
    47  terminal allocations and allocations from system jobs is considered empty under
    48  this strategy.
    49  
    50  ### `newest_create_index` Node Selector Strategy
    51  
    52  The `newest_create_index` strategy is the simplest strategy and uses the order
    53  in which nodes are returned by the [Nomad SDK][nomad_api_node_stub_sort]. The
    54  strategy is ideal for workloads and environments which can handle migrations
    55  due to scaling. It is also the least computationally intensive selector strategy.
    56  
    57  [nomad_api_terminal_alloc]: https://github.com/hashicorp/nomad/blob/14568b3e002868fc5c83ee7d158a78394c1ea9c1/api/allocations.go#L422-L442
    58  [nomad_api_node_stub_sort]: https://github.com/hashicorp/nomad/blob/14568b3e002868fc5c83ee7d158a78394c1ea9c1/api/nodes.go#L797-L810
    59  [system_scheduler]: /docs/schedulers#system