An affinity group is a simple orchestration policy designed for IaaS
resources to ensure your business high performances or high availability.
Affinity Group Policy
Currently, ZStack Cloud provides two
affinity group policies to better manage VM instances and hosts: anti-affinity group
(soft) and anti-affinity group (hard).
Anti-affinity group (soft):
Allocate VM instances in the affinity group to
different hosts as much as possible. If no more hosts are available, the
VM instances will be allocated randomly.
Anti-affinity group (hard):
Strictly allocate VM instances in the affinity
group to different hosts. If no more hosts are available, the allocation
fails.
The logic of these two anti-affinity groups is shown in Figure 1.Figure 1. Anti-Affinity Group (Soft) and Anti-Affinity Group (Hard)
Usage Scenario
This section provides some usage examples of anti-affinity group (soft) and
anti-affinity group (hard) policies.
Anti-affinity group (soft):
You might want to deploy nodes with different
Hadoop roles on different hosts to improve the overall system
performance.
For example, when you deploy a Hadoop system, you might find it
difficult to calculate the exact number of nodes of different roles
such as NameNode, DataNode, JobTracker, and TaskTracker. However,
you might know that deploying these nodes on different hosts is more
effective. With the anti-affinity group (soft) policy, you can
deploy Hadoop clusters on different hosts as much as possible, which
relieves the I/O pressure and improves the overall performance of
the system.
Anti-affinity group (hard):
You might want to deploy two VM instances that run
an active and a standby database on different hosts to ensure high
availability.
For example, you deploy two business VM instances to run an active
and a standby MySQL database respectively, and requires that the
active and standby databases cannot be down at the same time.
Therefore, you must deploy these two VM instances on different
hosts. Due to deployment automation, you might not predict which
hosts have sufficient resources. With the anti-affinity group (hard)
policy, you can choose two different hosts to run these two VM
instances respectively, which ensures the high availability.