Overprovisioned instances are becoming a nightmare for many engineers.
Solution? Rightsizing. It optimizes your compute power and keeps the finance folks happy.
In Kubernetes, rightsizing works in two ways:
Instance rightsizing – to make sure that your K8s workloads have just enough capacity to keep the lights on.
Workload rightsizing – setting your workloads to request the right amount of resources and run smoothly.
Ultimately, they’re both about saving 💸💸💸
Here are a bunch of best practices to help you ace instance rightsizing.
1. Define your minimum requirements
Identify the minimum size requirements of your application and make sure that the instance type you select can meet them across all dimensions:
CPU Count
CPU Architecture
Memory
SSD Storage
Network
An affordable instance might look tempting, but it might suffer performance issues when you start running CPU-intensive applications.
2. Choose the VM with cloud cost savings in mind
Cloud providers offer a range of instance types optimized to match different use cases, with various combinations of CPU, memory, storage, and networking capacity.
Each type includes one or more instance sizes, so you can scale your resources to fit your workload’s requirements.
AWS, Azure, and Google Cloud all have these four instance types:
General purpose – good for applications that use CPU and RAM in equal proportions like web servers with low to medium traffic and small to medium databases.
Compute optimized – works for web servers experiencing medium traffic, batch preprocessing, network appliances, and application servers.
Memory optimized – good for production workloads like database servers, relational database services, analytics, and larger in-memory caches.
Storage optimized – for workloads that require heavy read/write operations and low latency.
Each provider also offers different instance types for GPU workloads:
AWS – Accelerated computing, Inference type, GPU
Azure – GPU, High-performance compute
Google – Accelerator-optimized.
If this looks like a lot of options to consider, it is. 🤯 That’s one of the reasons why we built automatic instance type selection in CAST AI.
3. Take advantage of CPU bursting
Burstable performance instances were designed to offer teams a baseline level of CPU performance with the option to burst to a higher level when their workloads need it.
They’re a good match for low-latency interactive applications, microservices, small and medium databases, and product prototypes, among others.
Note: The amount of accumulated CPU credits depends on the instance type. Larger instances collect more credits per hour. However, there’s also a cutoff to the number of credits you can collect, and larger instance sizes come with a higher cutoff.
Examples of burstable performance instances:
AWS: T2, T3, T3a, and T4g.
Azure: B series VMs.
Google: shared-core VMs like e2-micro, e2-small, e2-medium.
Our research into AWS showed that if you load your instance for 4 hours or more per day, on average, you’re better off with a non-burstable one. But if you run an online store that gets a stream of visitors once in a while, it may be a good fit.
4. Check your storage performance limitations
Here’s another thing to consider when maximizing your cost savings: data storage.
Every application has unique storage needs. When choosing a VM, make sure that it has the storage throughput and IOPS your application requires.
Also, don’t opt for pricy drive options like premium SSDs unless you expect to employ them to the fullest.
5. Consider the network bandwidth
If you’re dealing with a massive data migration or a high volume of traffic, pay attention to the size of the network connection between your instance and the consumers assigned to it.
You can find some instances that can bolster 10 or 20 Gbps of transfer speed.
But here’s the caveat: only those instances will support this level of network bandwidth.
I hope this guide helps you rightsize instances and save up cash for more interesting things, like experimenting with new features.
Cheers,
Allen
__________________________
Found this email useful? Forward it to your friends and colleagues who need more Kubernetes best practices in their lives!
CAST AI Group Inc., 111 NE 1st Street, 8th Floor #1041, Miami,Florida,33132,United States,