Amazon Burstable Instances Explained
By Wilson T. MacDonald, Professional Services Engineer
What Are Burstable Instances?
T2 instances are an instance family from Amazon Web Services which provide a guaranteed level of CPU performance with the ability to burst to high levels of CPU utilization for transient loads. Each instance has a “baseline” of CPU utilization which is governed using what Amazon calls CPU Credits. CPU Credits are burned down while the instance is active, and accumulate when the instance is operating below the CPU baseline.
Take advantage of Amazon Burstable Performance Instances
When Would You Use Them?
T2 instances are used for applications that can benefit from quick access to high levels of CPU when needed, but most of the time are using moderate levels of CPU. Application examples include web servers, developer environments, and small databases. Additionally, T2 instances are the only option for nano, micro, and small instance types, making them a good choice if you are running a smaller workload that doesn’t warrant the capacity of larger instance types.
The larger instance types, t2.large, xlarge and 2xlarge, mirror the memory allocation for the equivalent M instance types, but with limitations on the amount of CPU available for sustained periods. If you are considering using these larger types, it’s important to determine if the average CPU load applied to the instance will exceed Baseline Performance. The rule of thumb is that the average CPU utilization of the instance should be 10%-15% lower than the baseline CPU for the equivalent T2 instance type with equivalent vCPUs (note: this is not 10-15% in absolute terms, but 10-15% of the Baseline Performance threshold). This is particularly true with applications which place a steady load on a processor.
Here is an example of a load which may suit a t2.medium over the equivalent m3.medium. The t2.medium is a 30% savings in compute cost. The CPU utilization averages below the 20% allocated for t2.medium, but periodically spikes for a short duration before reverting back to a nominal load. It appears that this instance would perform well as a t2.medium.
How Do They Work?
Burstable Instances receive a continuous allocation of CPU Credits. These credits may accumulate until they reach the credit limit, which is the number of credits accumulated in 24 hours. As long as the utilization of the CPU set is less than the incoming supply of credits, the credits will accumulate. Credits timeout after 24 hours.
One way to think of it is like a bucket, which has a stream of water flowing into it. Credits accumulate up to the limit, and are consumed as the application asks for compute resources. If the load is higher than the incoming rate the bucket will start to empty.
If the bucket is empty, the CPU is limited by the inflow of credits which limits performance to the baseline CPU percentage, until the load goes below baseline so credits can build up again.
Examples of Burstable Instances
This is an example of a T2 instance bursting. During a period of high utilization, the CPU bursts, and burns down the credit balance. The balance goes back to the maximum after utilization goes below the baseline.
Here, a period of activity draws down the balance, which then goes back to the maximum after the instance becomes idle.
In this example, the demand continues, the balance goes to zero, and the flow is limited to the incoming credits which in this case allows 20% utilization, with reduced ability to peak.
Here is an example where the CPU demand continuously exceeds the allocation and the balance is always at zero. This is an instance which appears to be over-utilized in that it is continuously operating at Baseline Performance, consuming CPU credits as soon as they are issued. This instance should be upgraded to a larger instance type, unless performance at this level is acceptable.
Here is a shift in utilization to above the Baseline CPU %. The credit balance is exhausted, and the instance is limited to the Baseline Performance.
Summing Up Burstable Instances
As the lowest-cost option, T2 instances are an important addition to Amazon instance families. While they provide the ability to burst, and cover high transient loads, it is important not to overmatch the instance with continuous high demand, which will result in a constrained output.
It is prudent to do testing of real world loads to see if the T2 instance is a good match. When testing, a best practice is to watch the CPU Credit Balance, as this will tell you whether the instance is undersized for the load which it is experiencing. Instances which consistently have a low CPU Credit Balance are candidates for changing to the equivalent M4 Instance Type, or a larger T2 Instance type. Instances where the CPU balance never goes below the maximum are candidates for downsizing. In those cases the average CPU is a good indicator of the appropriate migration target. As always “your mileage may vary”, so testing and benchmarking is a worthwhile exercise.