AWS – Placement Groups: The groups are nothing but gathering together and placement is nothing but placing the things at one point of place so the overall meaning is placing the things at one place or gathering the things together at one place is nothing but placement groups.
Now, let’s get into the actual definition of placement groups, Placement Groups are a way of a logical grouping of interdependent instances together in a selected region, or in other words as the name implies, a placement group is just a group. AWS instances that exist within a common availability zone can be grouped into a placement group. Where group members are able to communicate with one another in a way that provides low latency and high throughput.
What is a low latency?
Low latency means the faster transfer of traffic rate between the customer and the application or in other words it is defined as the end-to-end latency from the moment a record is written to the stream until it is read by a consumer application and this delay varies depending upon a number of factors, but it is primarily affected by the polling interval of consumer applications.
What is a high throughput?
High Throughput is the measure of the amount of data transferred from/to a storage device in a second. Typically stated in KB/MB/GB/s (e.g., if a storage device can write 1000 blocks of 128K each, throughput is 1000*128K/s = 128MB/s).
Why use Placement Group?
Placement groups help us to launch a bunch of EC2 instances close to each other physically within the same AZ. Being close physically and within the same AZ helps it take advantage of high-speed connectivity to provide low latency, high throughput access.
This can really work well for applications exchanging a lot of data and can provide high performance with collocation.
All nodes within the placement group can talk to all other nodes within the placement group at the full line rate of 10 Gbps single traffic flow without any slowing due to over-subscription.
When to use a Placement Group?
When applications reaching oversubscriptions or when there is a high latency etc.
How this will minimize hardware correlated failures?
When you launch a new EC2 instance, the EC2 service attempts to place the instance in such a way that all of your instances are spread out across underlying hardware to minimize correlated failures. You can use placement groups to influence the placement of a group of interdependent instances to meet the needs of your workload. Depending on the type of workload.
In another way, I can say that the EC2 instances are automatically evenly distributed across different zones to minimize failures.
Types of Placement Groups?
we can create a placement group using one of the following placement strategies:
- Cluster Placement Group: Packs instances close together inside an Availability Zone. This strategy enables workloads to achieve the low-latency network performance necessary for tightly-coupled node-to-node communication that is typical of HPC applications.
- Partition Placement Group: Spreads your instances across logical partitions such that groups of instances in one partition do not share the underlying hardware with groups of instances in different partitions. This strategy is typically used by large distributed and replicated workloads, such as Hadoop, Cassandra, and Kafka.
- Spread Placement Group: Strictly places a small group of instances across distinct underlying hardware to reduce correlated failures.
Cluster Placement Group
A cluster placement group is a logical grouping of instances within a single Availability Zone. A cluster placement group can span peered VPCs in the same region. Instances in the same cluster placement group enjoy a higher per-flow throughput limit of up to 10 Gbps for TCP/IP traffic and are placed in the same high-bisection bandwidth segment of the network.
In simple words, a cluster placement group is a way of grouping EC2 instances in a single Availability Zone in a single region and there are certain limits for every placement group that will discuss at the end of the topics don’t worry.
The following image shows instances that are placed in a cluster placement group.
Cluster Placement groups are recommended for applications that benefit from low network latency, high network throughput, or both. They are also recommended when the majority of the network traffic is between the instances in the group.
To provide the lowest latency and the highest packet-per-second network performance for your placement group, choose an instance type that supports enhanced networking.
Enhanced networking uses single root I/O virtualization (SR-IOV) to provide high-performance networking capabilities on supported instance types. SR-IOV is a method of device virtualization that provides higher I/O performance and lower CPU utilization when compared to traditional virtualized network interfaces. Enhanced networking provides higher bandwidth, higher packet per second (PPS) performance, and consistently lower inter-instance latencies. There is no additional charge for using enhanced networking.
There are two recommended steps to launch an instance using a cluster placement group, those are:
- While launching EC2 instances, launch multiple instances at a time with choosing the best and suitable placement group to halt insufficient capacity errors.
2. Better to select the same instance type and size for all remaining instances in a placement group.
When will the problem occur using a cluster placement group?
If you try to add more instances to the placement group later, or if you try to launch more than one instance type in the placement group, you increase your chances of getting an insufficient capacity error.
If you stop an instance in a placement group and then start it again, it still runs in the placement group. However, the start fails if there isn’t enough capacity for the instance.
How to solve those problems?
If you receive a capacity error when launching an instance in a placement group that already has running instances, stop and start all of the instances in the placement group, and try to launch again. Starting the instances may migrate them to hardware that has capacity for all of the requested instances.
Partition Placement Group
Partition placement groups help reduce the likelihood of correlated hardware failures for your application. When using partition placement groups, Amazon EC2 divides each group into logical segments called partitions.
Amazon EC2 ensures that each partition within a placement group has its own set of racks. Each rack has its own network and power source. No two partitions within a placement group share the same racks, allowing you to isolate the impact of a hardware failure within your application.
In simple words, the partition placement group is a way of grouping the instances together in different partitions in a single availability zone, this group has also some rules and limitations that will discuss at the end of this topic.
The following image is a simple visual representation of a partition placement group in a single Availability Zone.
It shows instances that are placed into a partition placement group with three partitions — Partition 1, Partition 2, and Partition 3. Each partition comprises multiple instances. The instances in a partition do not share racks with the instances in the other partitions, allowing you to contain the impact of a single hardware failure to only the associated partition.
Partition placement groups can be used to deploy large distributed and replicated workloads, such as HDFS, HBase, and Cassandra, across distinct racks.
When you launch instances into a partition placement group, Amazon EC2 tries to distribute the instances evenly across the number of partitions that you specify. You can also launch instances into a specific partition to have more control over where the instances are placed.
A partition placement group can have partitions in multiple Availability Zones in the same region. A partition placement group can have a maximum of seven partitions per Availability Zone. The number of instances that can be launched into a partition placement group is limited only by the limits of your account.
In addition, partition placement groups offer visibility into the partitions — you can see which instances are in which partitions. You can share this information with topology-aware applications, such as HDFS, HBase, and Cassandra. These applications use this information to make intelligent data replication decisions for increasing data availability and durability.
If you start or launch an instance in a partition placement group and there is insufficient unique hardware to fulfill the request, then the request fails. Amazon EC2 makes more distinct hardware available over time, so you can try your request again later.
Spread Placement Group
A spread placement group is a group of instances that are each placed on distinct racks, with each rack having its own network and power source.
In simple words, the spread placement group is a way of placing the instances in a single availability zone and we can distribute those instances across different availability zones.
The following image shows seven instances in a single Availability Zone that are placed into a spread placement group. The seven instances are placed on seven different racks.
Spread placement groups are recommended for applications that have a small number of critical instances that should be kept separate from each other. Launching instances in a spread placement group reduces the risk of simultaneous failures that might occur when instances share the same racks. Spread placement groups provide access to distinct racks, and are therefore suitable for mixing instance types or launching instances over time.
A spread placement group can span multiple Availability Zones in the same region. You can have a maximum of seven running instances per Availability Zone per group.
If you start or launch an instance in a spread placement group and there is insufficient unique hardware to fulfill the request, the request fails. Amazon EC2 makes more distinct hardware available over time, so you can try your request again later.
Placement Group Rules and Limitations
General Rules and Limitations
Before you use placement groups, be aware of the following rules:
- The name that you specify for a placement group must be unique within your AWS account for the Region.
- You can’t merge placement groups.
- An instance can be launched in one placement group at a time; it cannot span multiple placement groups.
- On-Demand Capacity Reservation and zonal Reserved Instances provide a capacity reservation for EC2 instances in a specific Availability Zone. The capacity reservation can be used by instances in a placement group. However, it is not possible to explicitly reserve capacity for a placement group.
- Instances with a tenancy of
hostcannot be launched in placement groups.
Cluster Placement Group Rules and Limitations
The following rules apply to cluster placement groups:
- When you launch an instance into a cluster placement group, you must use one of the following instance types:
- General-purpose: A1, M4, M5, M5a, M5ad, M5d, M5dn, and M5n
- Compute-optimized: C3, C4, C5, C5d, C5n, and
cr1.8xlarge, R3, R4, R5, R5a, R5ad, R5d, R5dn, R5n, X1, X1e, and z1d
- Storage optimized: D2, H1,
hs1.8xlarge, I2, I3, and I3en
- Accelerated computing: F1, G2, G3, G4dn, Inf1, P2, P3, and P3dn
- A cluster placement group can’t span multiple Availability Zones.
- The maximum network throughput speed of traffic between two instances in a cluster placement group is limited by the slower of the two instances. For applications with high-throughput requirements, choose an instance type with network connectivity that meets your requirements.
- For instances that are enabled for enhanced networking, the following rules apply:
- Instances within a cluster placement group can use up to 10 Gbps for single-flow traffic. Instances that are not within a cluster placement group can use up to 5 Gbps for single-flow traffic.
- Traffic to and from Amazon S3 buckets within the same Region over the public IP address space or through a VPC endpoint can use all available instance aggregate bandwidth.
- You can launch multiple instance types into a cluster placement group. However, this reduces the likelihood that the required capacity will be available for your launch to succeed. We recommend using the same instance type for all instances in a cluster placement group.
- Network traffic to the internet and over an AWS Direct Connect connection to on-premises resources is limited to 5 Gbps.
Partition Placement Group Rules and Limitations
The following rules apply to partition placement groups:
- A partition placement group supports a maximum of seven partitions per Availability Zone. The number of instances that you can launch in a partition placement group is limited only by your account limits.
- When instances are launched into a partition placement group, Amazon EC2 tries to evenly distribute the instances across all partitions. Amazon EC2 doesn’t guarantee an even distribution of instances across all partitions.
- A partition placement group with Dedicated Instances can have a maximum of two partitions.
- Partition placement groups are not supported for Dedicated Hosts.
Spread Placement Group Rules and Limitations
The following rules apply to spread placement groups:
- A spread placement group supports a maximum of seven running instances per Availability Zone. For example, in a Region with three Availability Zones, you can run a total of 21 instances in the group (seven per zone). If you try to start the eighth instance in the same Availability Zone and in the same spread placement group, the instance will not launch. If you need to have more than seven instances in an Availability Zone, then the recommendation is to use multiple spread placement groups. Using multiple spread placement groups does not provide guarantees about the spread of instances between groups, but it does ensure the spread for each group, thus limiting the impact from certain classes of failures.
- Spread placement groups are not supported for Dedicated Instances or Dedicated Hosts.
Hope you now have a better understanding of AWS Placement Groups. Still have any question please feel free to use comment box 🤓