How powerful are the burstable aws t2 instances
I am probably not the only one that noticed the server’s CPU is mostly under 10% with few spikes during the day. There is no need to pay for a dedicated instance if you don’t have a baseline CPU utilization over 50%. Here, at Algotech Solutions, we love using various tips and tricks to optimise… well, everything! So here’s the tip: You just need an instance that accommodates your baseline and allows you to burst. The following article will de-mistify the different types of aws instances and propose a cheaper budgeting plan for your cloud, using t2 instances.
About Amazon AWS
Amazon EC2 has over 40 different instance types grouped by instance family. It is the prefix before the period in the instance name, for example the m4.large instance is in the family m4. Right now, the following last generation families are available:
- General Purpose instances
- T2: are Burstable Performance Instances that provide a baseline level of CPU performance with the ability to burst above the baseline. The baseline performance and ability to burst are governed by CPU Credits. Each T2 instance receives CPU Credits continuously at a set rate depending on the instance size. T2 instances increase CPU Credits when they are idle, and use CPU credits when they are active. They are a great choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst.
- M4: are the last generation of General Purpose Instances. This family provides a balance of compute, memory, and network resources, and it is a good choice for many applications that use CPU consistently.
- Compute Optimized – C4 instances are the last generation of Compute-optimized instances, featuring the highest performing processors and the lowest price/compute performance in EC2. The cheapest version has 2 vCPU and 3,75 GB RAM while the most powerful has 36 vCPU and 60 GB RAM.
- Memory Optimized – R3 instances are optimized for memory-intensive applications and have the lowest cost per GB of RAM among Amazon EC2 instance types. The cheapest version has 2 vCPU and 15,25 GB RAM while the most powerful has 32 vCPU and 244 GB RAM.
- There is also the G2 family for GPU compute workloads and I2 and D2 families for storage (SSD and HDD).
What exactly are t2 burstable instances?
CPU bursting isn’t new – other cloud and VPS services have used it for years, but often these services use a free-for-all approach that results in erratic and unpredictable CPU performance. A t2 instance lets users predictably and reliably burst CPU periodically. The t2 instances give users a large amount of baseline capacity with the ability to automatically and transparently scale up to full-core processing power on an as-needed basis. The bursting model is based on “CPU Credits” that accumulate during quiet periods for spending when things get busy.
T2 was released in 2014 by AWS and remains, in my opinion, one of the least appreciated instance types. They are very low cost, from under $5/mo to $76/mo for Linux in the US East (N. Virginia) AWS Region. Users can provision an instance of modest size and cost and still have more than adequate compute power in reserve to handle peak demands for compute power. It is also essential to choose the right size based on their CPU and memory requirements. Many applications rarely need even the baseline level of power, and will accumulate CPU Credits for those times when the application needs to burst.
Where does t2 work great?
Plenty of different usage profiles could fit this pattern. For example, consider running one service that makes out the whole CPU but only does it 10% of the time, in that situation a t2.micro instance is perfect. Similarly, if an application or database needs lots of CPU to serve individual requests with low latency, but idles between requests, then a t2 is advantageous too.
If you have workloads with 20% or lower peak/burst CPU usage, t2 instances are an excellent choice. There are many good use cases for this: development environments, websites with periodic traffic spikes, build servers, etc. If your workload CPU requirements are more stable, then t2 instances aren’t the best choice.
How AlgoTech Solutions uses t2 instances:
- Our GitLab instance. It stays idle most of the time, but when we push/pull or check the issues/merges we need it to be fast. We use a t2.medium instance that offers 2 cores and 4 GB of RAM at the price of $20/month (as a reserved instance).
- The Continuous integration runner service, that takes care of building, testing and deploying all our projects. T2 is particularly brilliant here, because it sits idle between builds but the high peak CPU performance means our builds are really fast. See the CPU utilization graph below for one of our CI runner instance. By the way, you can find out more about our CI process by reading the dedicated article.
- Most of the instances serving front-end applications for our clients. These instances typically spend most of their time either idle between requests or waiting on network activity to other services. They rarely go over the baseline CPU level.
- Any applications and databases powering our internal tools which have relatively low traffic like CRM and ATS platforms.
Performance, power and low costs
The best part about the t2 instances is that, as long as you don’t spend all your CPU credits, you enjoy the performance and all the power of a much larger instance, but at a fraction of the cost. As far as the services on your instance are concerned, they’re running on a c4.large(ish)-sized instance, but costing a fraction of the price.
We’ve recently migrated a number of services to t2 instances for one of our clients. We’re now running more than 50% more EC2 instances than before, but paying roughly 40% less in equivalent on-demand cost. Compared to the previous instances, we’re enjoying all the benefits of great peak performance for these services, such as reduced request latency.
Many people hear this and think, “Well, that’s nice for dev/test, but I need guaranteed CPU for production!”. However, the reality is more complex. In truth, even in this cloud era where you can resize instances as you wish, most servers are still over-provisioned to account for bursts; actual CPU usage is usually 5-20% for even moderately busy applications.
Take a closer look at the t2 instance family. Your cloud budget will thank you!