Previous Azure API Gateway Availability Sets in Azure Next

Affinity Groups in Cloud Computing

Affinity Groups in Cloud Computing

Affinity groups are logical groupings of virtual machines (VMs) or instances that control how resources are placed across physical hosts. They help optimize performance, improve fault tolerance, and enforce security or compliance policies.

đź§© What Are Affinity Groups?

An affinity group defines a placement rule for a set of VMs:

  • Host Affinity: VMs are placed on the same physical host to reduce latency and improve inter-instance communication.
  • Host Anti-Affinity: VMs are placed on different hosts to increase fault tolerance—so if one host fails, others remain unaffected.

🛠️ Practical Use Cases

Use Case Affinity Type Benefit
Microservices needing fast IPC Host Affinity Low latency, high bandwidth
Redundant web servers Host Anti-Affinity High availability, fault isolation
Compliance zones Host Affinity Controlled placement for audit trails
Load-balanced clusters Host Anti-Affinity Distributed load, resilience

⚙️ Types of Affinity Rules

  • Strict Affinity / Anti-Affinity: Enforced rigidly — if the rule can’t be met, deployment fails.
  • Non-Strict (Adaptive): Best-effort placement — if ideal conditions aren’t met, fallback placement is allowed.

đź§  Why Use Affinity Groups?

For multi-tenant SaaS or modular deployments, affinity groups let you:

  • Group tenant-specific VMs to isolate workloads.
  • Use anti-affinity for high-availability clusters.
  • Apply affinity for tightly coupled services (e.g., auth servers and cache layers) to reduce latency.
Back to Index
Previous Azure API Gateway Availability Sets in Azure Next
*