For workloads that don’t require a consistent CPU performance but do experience spikes in service demand, Amazon’s AWS EC2 service offers Burstable Performance Instances. Their competitive pricing can contribute to considerable savings and improve service availability, but how do you know if you are getting a good deal? You don’t, unless you are able to verify your CPU credits usage and the remaining balance. Here is how to figure out what’s really going on.
In terms of its CPU performance, each type of an AWS EC2 instance belongs to one of two different categories:
- Fixed Performance Instances (m3, c3, etc.) and
- Burstable Performance (such as t2).
A Fixed Performance Instance offers a consistent CPU performance throughout its lifetime, which also means that you will be paying for all idle CPU cycles even though your instance isn’t using them.
Burstable Performance Instances provide a baseline CPU performance that allows your instance to operate predictably and burst on demand.
When you create an instance of the Burstable Performance type, AWS allocates to it an initial amount of CPU credits. Hour by hour, your instance keeps accruing a certain amount of CPU credits that accumulate over the course of a month. During spikes of demand for CPU resources, an instance with a positive credit balance may temporarily increase its CPU performance and meet its operational requirements far above the baseline level, up to the total amount of available CPU credits.
A real-world example of a burstable performance instance on EC2 in action
In the image below, you can see the CloudWatch Monitoring Details graph depicting the metric CPU Credit Usage for a burstable performance instance on EC2 as a Maximum in a period of 5 minutes. The sudden spike in credit balance was a result of computing an 8192 bit Diffie-Hellman encryption job.
The following graph shows the other side of the coin: the metric CPU Credit Balance for the same burstable performance instance on EC2: the drop in credit balance is a result of the same 8192 bit Diffie-Hellman encryption job.
The above graph shows that the remaining credits balance continues to offer a sufficient margin of safety (even though at one point the remaining balance had fallen considerably, it has never reached the bottom and it has managed to somewhat recover).
Baseline performance is guaranteed
Should your instance run out of CPU credits (your CPU Credit Balance fall to zero), your instance will continue to operate on baseline performance until it receives additional credit.
Verify your balance of CPU credits
You can verify your balance of CPU credits over time using the AWS Management Console for CloudWatch. Navigate to the section Metrics > EC2 and filter the list of available metrics using the Seatch Metrics field either by instance ID or by metric name.
Select the instance(s) you want to investigate by activating the checkbox next to each relevant entry. The AWS Management Console displays the relevant graphs in the lower section of the document window. You can navigate along the timeline and adjust other parameters.
Look at these metrics:
- CPUCreditUsage, and