Amazon Burstable Instances Explained
What Are Amazon Burstable Instances?
Amazon burstable instances ( or 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 Amazon Burstable Instances?
Amazon burstable instances (or 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 burstable CPU 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 Amazon Burstable Instances Work?
Amazon 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.
Unlimited Amazon T2 Burstable Performance
In November 2017, Amazon launched T2 instance types with unlimited burstable performance - “T2 Unlimited”. These T2 burstable instances work in exactly the same way as “Standard” AWS burstable instances except they can “borrow” an entire day´s worth of future credits in order to allow the burstable CPU to continue bursting. If demand continues above the CPU Baseline, and the day´s CPU Credits are exhausted, the instance continues to deliver burstable performance charged at the rate of $0.05 per vCPU per hour for Linux and $0.096 per vCPU per hour for Windows.
Using a t2.nano instance as an example of how an instance with unlimited Amazon T2 burstable performance works, we can see that CPU utilization grows to 100% and the instance begins to consume 5 CPU Credits every five minutes (1 credit is equivalent to a vCPU-minute).
In the second image we see the CPU credit balance remains at 0 because the credits are being produced and consumed at the same rate. The surplus credit balance (tracked by the new CPU Surplus Credit Balance metric) increases to 72, representing the credits that are being borrowed from the future.
Once the surplus credit balance reaches 72, the day´s CPU Credits are exhausted, and further usage of the burstable CPU usage is charged. Unlimited T2 instances with burstable performance consume 5 CPU Credits every five minutes and earn 0.25 CPU Credits, resulting in a net charge of 4.75 vCPU-minutes for each five minutes of AWS T2 burstable performance.
You can create T2 instance types with unlimited burstable CPU through the EC2 console and also switch existing instances between T2 Standard and T2 Unlimited at any time - even when they are running. T2 Unlimited instances can be ideal for use in Auto Scaling Groups and in other use case scenarios in which large volumes of EC2 instances are launched and terminated every day.