EC2 placement groups: cluster vs partition vs spread
The EC2 User Guide describes three main strategies. A cluster placement group packs instances close together in one Availability Zone for low latency and high throughput. A partition placement group splits instances into partitions that share no racks. A spread placement group puts each instance on distinct hardware, with at most seven running instances per Availability Zone.
When do you use a cluster placement group?
Use it when most of the traffic is between the instances in the group and the application needs low network latency, high network throughput, or both. The instances sit in the same high-bisection bandwidth segment of the network. A cluster placement group cannot span Availability Zones.
Current generation instance types are supported, except burstable performance instances such as T2, Mac1 instances and M7i-flex instances. Instances with enhanced networking can use up to 10 Gbps for single-flow traffic inside the group, against 5 Gbps outside one.
AWS recommends launching all the instances you need in a single request and using one instance type. Adding instances later, or mixing types, raises the chance of an insufficient capacity error. If a launch into a group with running instances fails for capacity, stop and start all the instances in the group and try again.
When do you use a partition placement group?
Use it for large distributed and replicated workloads such as HDFS, HBase and Cassandra. EC2 gives each partition its own set of racks, and each rack has its own network and power source, so a hardware failure affects one partition only.
A partition placement group can have up to seven partitions per Availability Zone and can use several zones in a Region. The number of instances is limited only by your account limits. You can see which instances are in which partition and pass that to topology-aware applications. EC2 tries to spread instances evenly across partitions but does not guarantee it.
When do you use a spread placement group?
Use it for a small number of critical instances that must be kept apart. Each instance is placed on distinct hardware, which suits mixing instance types or launching instances over time.
A rack-level spread placement group can span Availability Zones in a Region but supports at most seven running instances in each zone. An eighth instance in a zone that already has seven does not launch. If you need more, AWS recommends using several spread placement groups.
If there is not enough unique hardware for a launch or start in a spread or partition group, the request fails, and you can try again later.
Where the exam catches people
Choosing a spread placement group for more than seven instances in one Availability Zone: the limit is seven running instances per zone.
Stretching a cluster placement group across Availability Zones for resilience: a cluster placement group cannot span zones.
Believing the spread limit counts stopped instances: the limit is on running instances in each zone.
Putting burstable T2 instances in a cluster placement group: burstable performance instances are not supported there.
Believing partitions always hold equal numbers of instances: EC2 tries for an even distribution but does not guarantee it.