Getty Images/iStockphoto
Reduce latency with the right AWS placement group
When prioritizing latency in AWS, evaluate the advantages and limitations of placement groups and how they fit the desired cloud architecture outcome for an application.
Cloud applications often have strict requirements. There are distributed applications with specific needs regarding the deployment of internal nodes within a specific geography and hardware. These characteristics are driven by latency, scalability and availability requirements of the applications these back-end components support.
AWS users can choose to optimize how EC2 instances are deployed in a distributed environment. Typically, distributed nodes are launched as EC2 instances in multiple Availability Zones (AZs) within an AWS Region. This setup is a good practice for applications where nodes are independent of each other and don't exchange much data among themselves.
There are applications where EC2 instances interact heavily with each other and need to be deployed within a single AZ to reduce latency and optimize data throughput across nodes. By default, when EC2 instances are launched in a single AZ, they are deployed on different hardware. While this is the best scenario for many applications, there are situations where it's not necessarily the desired deployment strategy.
One option is to use AWS placement groups, which can optimize distributed applications in the cloud. Let's look at the three group strategies and how to configure them to help reduce latency.
AWS placement group strategies
AWS placement groups offer flexibility. Whether one or multiple AZs, the flexibility comes in the underlying physical infrastructure on which EC2 instances will be deployed. Placement groups offer three types of configurations: cluster, partition and spread.
Cluster placement group
A cluster placement group launches a logical grouping of EC2 instances within a single AZ. This optimizes data transfer speed and bandwidth across nodes. AWS charges for data transfers across different AZ. Data transfers within a single AZ is free. By placing EC2 instances in a single AZ, it can be cost-effective for nodes that exchange large amounts of data.
This setting is a good fit for applications with nodes that perform complex computing tasks and interact heavily with each other, such as data analytics platforms. For optimal performance, enable enhanced networking for EC2 instances and ensure those selected instance types deliver the required network bandwidth.
Partition placement group
Partition placement groups launch EC2 instances according to preconfigured infrastructure groups called partitions. Here, nodes that belong to a specific partition are deployed on the same underlying hardware. Each partition has its own independent hardware assignment. EC2 instances across different partitions are separate from each other.
Partitions are a common requirement in some data storage and data processing applications. Records are segmented across data partitions based on specific application properties, such as data keys and data ranges. If needed, IT teams can configure partitions across multiple AZs within the same AWS Region.
Spread placement group
A spread placement group is the opposite configuration of a cluster placement group. Each EC2 instance in a group is launched on separate, independent hardware within the same or different AZ in a single AWS Region. This setting is relevant for critical applications with low fault tolerance that require each node to be independent of the others. Spread placement groups also support AWS Outposts. This is a feature that enables AWS-managed infrastructure deployed on premises.
Placement group restrictions
While placement groups deliver critical features for many applications, it's important to understand their restrictions. Notably, infrastructure flexibility is significantly reduced. This can result in EC2 instances failing to launch due to limitations on the available hardware for a particular configuration.
It is possible that a partition or cluster has too little capacity remaining or that not enough hardware is available for spread instance placement. In the case of cluster placement groups, being limited to a single AZ is an important risk that IT teams need to evaluate against the performance and data transfer cost benefits of placing EC2 instances so close to each other. Placement groups don't incur additional AWS cost.
How to configure placement groups
IT teams can configure placement groups from the EC2 console, AWS Command Line Interface, SDK or CloudFormation. The configuration flow is simple.
Step 1. From the EC2 console, click the Placement Groups on the left side navigation bar.
Step 2. This takes users to the Placement Groups dashboard. Select Create placement group.
Step 3. When launching an EC2 instance from the console, you can select an existing Placement Group under the Advanced Details section of the launch page.
Placement groups are an option to consider for applications with specific needs in terms of hardware allocation. This feature provides advanced configurations that can significantly optimize applications deployed on EC2 instances, but it's not necessarily a good fit for all applications.