Este contenido no está disponible en el idioma seleccionado.

9.6. Utilization and Placement Strategy


Pacemaker decides where to place a resource according to the resource allocation scores on every node. The resource will be allocated to the node where the resource has the highest score. This allocation score is derived from a combination of factors, including resource constraints, resource-stickiness settings, prior failure history of a resource on each node, and utilization of each node.
If the resource allocation scores on all the nodes are equal, by the default placement strategy Pacemaker will choose a node with the least number of allocated resources for balancing the load. If the number of resources on each node is equal, the first eligible node listed in the CIB will be chosen to run the resource.
Often, however, different resources use significantly different proportions of a node’s capacities (such as memory or I/O). You cannot always balance the load ideally by taking into account only the number of resources allocated to a node. In addition, if resources are placed such that their combined requirements exceed the provided capacity, they may fail to start completely or they may run run with degraded performance. To take these factors into account, Pacemaker allows you to configure the following components:
  • the capacity a particular node provides
  • the capacity a particular resource requires
  • an overall strategy for placement of resources
The following sections describe how to configure these components.

9.6.1. Utilization Attributes

To configure the capacity that a node provides or a resource requires, you can use utilization attributes for nodes and resources. You do this by setting a utilization variable for a resource and assigning a value to that variable to indicate what the resource requires, and then setting that same utilization variable for a node and assigning a value to that variable to indicate what that node provides.
You can name utilization attributes according to your preferences and define as many name and value pairs as your configuration needs. The values of utilization attributes must be integers.
As of Red Hat Enterprise Linux 7.3, you can set utilization attributes with the pcs command.
The following example configures a utilization attribute of CPU capacity for two nodes, naming the attribute cpu. It also configures a utilization attribute of RAM capacity, naming the attribute memory. In this example:
  • Node 1 is defined as providing a CPU capacity of two and a RAM capacity of 2048
  • Node 2 is defined as providing a CPU capacity of four and a RAM capacity of 2048
# pcs node utilization node1 cpu=2 memory=2048
# pcs node utilization node2 cpu=4 memory=2048
The following example specifies the same utilization attributes that three different resources require. In this example:
  • resource dummy-small requires a CPU capacity of 1 and a RAM capacity of 1024
  • resource dummy-medium requires a CPU capacity of 2 and a RAM capacity of 2048
  • resource dummy-large requires a CPU capacity of 1 and a RAM capacity of 3072
# pcs resource utilization dummy-small cpu=1 memory=1024
# pcs resource utilization dummy-medium cpu=2 memory=2048
# pcs resource utilization dummy-large cpu=3 memory=3072
A node is considered eligible for a resource if it has sufficient free capacity to satisfy the resource’s requirements, as defined by the utilization attributes.

9.6.2. Placement Strategy

After you have configured the capacities your nodes provide and the capacities your resources require, you need to set the placement-strategy cluster property, otherwise the capacity configurations have no effect. For information on setting cluster properties, see Chapter 12, Pacemaker Cluster Properties.
Four values are available for the placement-strategy cluster property:
  • default — Utilization values are not taken into account at all. Resources are allocated according to allocation scores. If scores are equal, resources are evenly distributed across nodes.
  • utilization — Utilization values are taken into account only when deciding whether a node is considered eligible (that is, whether it has sufficient free capacity to satisfy the resource’s requirements). Load-balancing is still done based on the number of resources allocated to a node.
  • balanced — Utilization values are taken into account when deciding whether a node is eligible to serve a resource and when load-balancing, so an attempt is made to spread the resources in a way that optimizes resource performance.
  • minimal — Utilization values are taken into account only when deciding whether a node is eligible to serve a resource. For load-balancing, an attempt is made to concentrate the resources on as few nodes as possible, thereby enabling possible power savings on the remaining nodes.
The following example command sets the value of placement-strategy to balanced. After running this command, Pacemaker will ensure the load from your resources will be distributed evenly throughout the cluster, without the need for complicated sets of colocation constraints.
# pcs property set placement-strategy=balanced

9.6.3. Resource Allocation

The following subsections summarize how Pacemaker allocates resources.

9.6.3.1. Node Preference

Pacemaker determines which node is preferred when allocating resources according to the following strategy.
  • The node with the highest node weight gets consumed first. Node weight is a score maintained by the cluster to represent node health.
  • If multiple nodes have the same node weight:
    • If the placement-strategy cluster property is default or utilization:
      • The node that has the least number of allocated resources gets consumed first.
      • If the numbers of allocated resources are equal, the first eligible node listed in the CIB gets consumed first.
    • If the placement-strategy cluster property is balanced:
      • The node that has the most free capacity gets consumed first.
      • If the free capacities of the nodes are equal, the node that has the least number of allocated resources gets consumed first.
      • If the free capacities of the nodes are equal and the number of allocated resources is equal, the first eligible node listed in the CIB gets consumed first.
    • If the placement-strategy cluster property is minimal, the first eligible node listed in the CIB gets consumed first.

9.6.3.2. Node Capacity

Pacemaker determines which node has the most free capacity according to the following strategy.
  • If only one type of utilization attribute has been defined, free capacity is a simple numeric comparison.
  • If multiple types of utilization attributes have been defined, then the node that is numerically highest in the most attribute types has the most free capacity. For example:
    • If NodeA has more free CPUs, and NodeB has more free memory, then their free capacities are equal.
    • If NodeA has more free CPUs, while NodeB has more free memory and storage, then NodeB has more free capacity.

9.6.3.3. Resource Allocation Preference

Pacemaker determines which resource is allocated first according to the following strategy.
  • The resource that has the highest priority gets allocated first. For information on setting priority for a resource, see Table 6.3, “Resource Meta Options”.
  • If the priorities of the resources are equal, the resource that has the highest score on the node where it is running gets allocated first, to prevent resource shuffling.
  • If the resource scores on the nodes where the resources are running are equal or the resources are not running, the resource that has the highest score on the preferred node gets allocated first. If the resource scores on the preferred node are equal in this case, the first runnable resource listed in the CIB gets allocated first.

9.6.4. Resource Placement Strategy Guidelines

To ensure that Pacemaker's placement strategy for resources works most effectively, you should take the following considerations into account when configuring your system.
  • Make sure that you have sufficient physical capacity.
    If the physical capacity of your nodes is being used to near maximum under normal conditions, then problems could occur during failover. Even without the utilization feature, you may start to experience timeouts and secondary failures.
  • Build some buffer into the capabilities you configure for the nodes.
    Advertise slightly more node resources than you physically have, on the assumption the that a Pacemaker resource will not use 100% of the configured amount of CPU, memory, and so forth all the time. This practice is sometimes called overcommit.
  • Specify resource priorities.
    If the cluster is going to sacrifice services, it should be the ones you care about least. Ensure that resource priorities are properly set so that your most important resources are scheduled first. For information on setting resource priorities, see Table 6.3, “Resource Meta Options”.

9.6.5. The NodeUtilization Resource Agent (Red Hat Enterprise Linux 7.4 and later)

Red Hat Enterprise Linux 7.4 supports the NodeUtilization resource agent. The NodeUtilization agent can detect the system parameters of available CPU, host memory availability, and hypervisor memory availability and add these parameters into the CIB. You can run the agent as a clone resource to have it automatically populate these parameters on each node.
For information on the NodeUtilization resource agent and the resource options for this agent, run the pcs resource describe NodeUtilization command.
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

© 2024 Red Hat, Inc.