Lesson 3 of 6 Amazon EC2

Choosing an EC2 Placement Group Strategy

This lesson explains how placement groups control where EC2 places instances on hardware, trading network performance against resilience to hardware failure.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish cluster, spread and partition placement groups.
  • Explain how capacity is obtained for cluster placement groups.
  • Choose a strategy from the requirement.

Placement strategies

A placement group influences where EC2 places instances on the underlying hardware, trading performance against the risk of correlated failure. A cluster placement group puts instances close together in one Availability Zone, on a network segment with low latency and high bandwidth between them. It gives the best node-to-node performance for tightly coupled HPC jobs, but a problem in that zone or rack can affect every instance.

A spread placement group puts each instance on distinct hardware, with its own power and network, so no two fail together. It is limited to seven running instances per Availability Zone per group, so it suits a small number of critical instances, such as the nodes of a primary and standby pair. A partition placement group divides instances into partitions on separate racks, up to seven per Availability Zone, with hundreds of instances in total, and tells each instance which partition it is in. Distributed systems such as HDFS, HBase, Cassandra and Kafka use this to keep replicas in different partitions. The following table summarises the strategies.

TypePlacementLimitsUse for
ClusterClose together in one AZ, on a low-latency, high-bandwidth network segmentNo AZ spread: performance over availabilityTightly coupled HPC, low-latency node-to-node traffic
SpreadEach instance on distinct hardware with its own power and networkMax 7 running instances per AZ per groupA few critical instances that must not fail together
PartitionGroups of instances on separate racks, with partition information exposed to the applicationUp to 7 partitions per AZ, hundreds of instancesHDFS, HBase, Cassandra, Kafka

The following diagram shows how each strategy places instances on hardware.

The three placement strategies. A cluster placement group packs instances close together in one Availability Zone for low latency and high bandwidth. A spread placement group puts each instance on distinct hardware, up to seven per AZ. A partition placement group divides instances into partitions on separate racks, up to seven per AZ, so distributed systems can keep replicas apart.
The numbers of racks and instances are illustrative; only the spread and partition limits of seven per AZ are fixed.
Sort into groups

Cluster, spread or partition?

Exam skills 3.2.3 · 2.2.4

Choose the placement strategy for each requirement.

Log in to try this activity Interactive activities are free with an account.

Using cluster placement groups

A cluster placement group packs instances close together in one Availability Zone for the lowest latency and highest throughput between them, and getting capacity for it needs care. All instances should be launched in a single request with the same instance type, so EC2 can find capacity for all of them together; adding instances later is more likely to fail.

If a launch fails with an insufficient capacity error, stopping and starting all the instances in the group can move them to hardware with room, or a Capacity Reservation can secure the capacity in advance. For the lowest latency, cluster placement groups are combined with enhanced networking and the Elastic Fabric Adapter.

Troubleshooting scenario

Insufficient capacity

Exam skills 3.2.3

Resolve a capacity problem in a cluster placement group.

Log in to try this activity Interactive activities are free with an account.

Choosing a strategy

The appropriate placement strategy is determined by the requirement. The following table identifies the strategy suited to each.

RequirementStrategy
Lowest latency between nodesCluster
Protect a small number of critical instances from simultaneous failureSpread
Large distributed system that is aware of racksPartition
Worked example

Three placement strategies

Each placement strategy suits a different workload. The following table identifies the appropriate placement group for three workloads and the reason in each case.

WorkloadPlacement groupWhy
Tightly coupled HPC simulation needing the lowest latency between nodesClusterSame rack area in one AZ
Three critical instances that must not fail togetherSpreadEach on distinct hardware
A 60-node Kafka or HDFS cluster that is aware of failure domainsPartitionGroups of instances on separate racks

A cluster placement group trades availability for performance, because everything is in one AZ. For an application with a slow start-up whose in-memory state should survive stopping, EC2 hibernation saves the memory contents to the encrypted EBS root volume.

Check yourself

How many running instances can a spread placement group have in each Availability Zone?

Show answer

Seven, each on distinct hardware, so a single hardware failure affects at most one of them.

Exam Tips

Remember for the exam

  • For the lowest latency between HPC nodes, use a cluster placement group.
  • To protect a few critical instances from simultaneous hardware failure, use a spread placement group.
  • For rack awareness in Kafka or Cassandra, use a partition placement group.
  • A cluster placement group lives in one Availability Zone: high performance, low resilience.
  • A spread placement group holds at most seven running instances per Availability Zone.