Placement group is a very cool feature to improve compute capacity or improve solution availability that few people notice. This article Kevin shares about Placement Group and the characteristics of each type of Placement Group.
By default, when you launch an EC2 instance, AWS will attempt to initialize the instance on hardware that minimizes errors as much as possible, which means optimally random. This AWS does very well, but if there are some higher requirements, more specific to change this arrangement randomly the way I choose, it is the Placement Group.
There are 3 types of Placement Group that you can choose from:
- Cluster – Group of instances in the same AZ. The purpose of this strategy is to create a pool of instances with low-latency-network benefits. This type is necessary for applications that need to be tightly coupled, such as HPC (High Performance Computing) applications.
- Does not support burstable performance instances (eg T2) and Mac1.
- Can’t span out multiple AZs.
- Maximum network performance between 2 instances will be equal to whichever instance has the smaller parameter.
- Network traffic to the internet or through DX is limited to 5Gbps.
- Partition – This type is divided into different partitions, each of which contains instances, and between partitions that do not share the same hardware. This is beneficial when designing applications that do not allow the death of one group to affect the rest. This type of Placement group is often used for distributed applications such as Hadoop, Cassandra, Kafka.
- Supports up to 7 partitions/AZ. Assuming Region has 3 AZs, there will be a maximum of 21 partitions.
- When launching a new instance AWS will make an effort to distribute it evenly among the partitions.
- If you use Dedicated instances, you can only create up to 02 partitions.
- Spread – Place a small group of instances spread across separate hardware to minimize errors.
- Works in both Region.
- Each AZ can launch up to 7 instances. Each instance will not share the underlying hardware.
- Spread placement group does not support Dedicated Instances.
A few general notes when using placement groups:
- It is recommended to initialize the placement group with the number of instances at the same time because when adding new instances to an existing placement group, an error may arise due to not having hardware that meets the requirements of the placement group.
- When you get an error, re-initialize placement to ensure there are enough resources.
- The same instance type should be used when initializing the placement group.
- The name of the placement group must be unique in the AWS Region.
- Placement groups cannot be merged.
- An instance belongs to only one placement group
- Dedicated Host cannot be used in placement group.