Rightsizing Compute
Rightsizing is the most common usage optimization and one of the most valuable. This lesson explains what rightsizing is, which data it needs, how to do it safely and why it should come before commitment purchases.
Learning outcomes
After completing this lesson, you will be able to:
- Explain rightsizing and why resources become oversized.
- Identify the utilization data rightsizing requires.
- Describe a safe rightsizing process.
- Explain why rightsizing should precede commitment purchases.
- Calculate the saving from a rightsizing change.
What rightsizing is
Rightsizing matches a resource's size to the demand it actually serves. A virtual machine with 16 virtual CPUs and 64 GiB of memory that never uses more than 3 CPUs and 12 GiB is paying for capacity it does not need. Moving it to a size with 4 virtual CPUs and 16 GiB can cut its cost by about three quarters with no loss of performance.
Rightsizing applies to more than virtual machines: database instances, container requests, provisioned storage performance, provisioned throughput and the memory setting of serverless functions can all be oversized. The principle is the same: measure, compare with capacity and adjust.
Why resources end up oversized
Oversizing is rarely careless; it usually has an understandable cause. The following list describes the most common ones.
- Migration habits: sizes copied from data center servers that were bought for peak demand plus years of growth.
- Fear of incidents: engineers who have been paged for an overloaded server add generous headroom.
- Unknown demand: new services sized for an optimistic forecast that never materialized.
- Load changes: a service whose traffic moved elsewhere keeps its original size.
- Templates: a default size in a template applied to every service regardless of need.
Understanding the cause helps to prevent recurrence, for example by changing the template default or by sizing new services small and relying on monitoring and autoscaling.
The data rightsizing needs
Rightsizing decisions are only as good as the utilization data behind them. The following terms describe what to collect.
- Look-back period
- At least two to four weeks, and longer for workloads with monthly or seasonal peaks such as month-end processing.
- Peak and percentiles
- The maximum and a high percentile, such as the 95th or 99th, not only the average, which hides spikes.
- CPU
- Usually collected by default by the provider's monitoring service.
- Memory
- Usually requires an agent inside the instance; without it, recommendations may ignore memory pressure.
- Network and disk
- Throughput and IOPS, which can be the binding constraint for some workloads.
Provider recommenders, such as AWS Compute Optimizer, Azure Advisor and Google Cloud's VM rightsizing recommendations, analyze these metrics and propose sizes. Their quality improves markedly when memory metrics are available and when the look-back period covers the workload's real cycle.
The following diagram shows why incomplete evidence is not enough to act on a recommendation.

Data for rightsizing
Doing it safely
The following steps describe a safe rightsizing process.
-
Find candidates
Rank resources by potential saving, using recommendations or utilization joined with cost.
-
Check constraints
Confirm memory, network, licensing and any application requirements, such as a minimum CPU count.
-
Choose the target
Keep headroom above the observed peak, for example aiming for peak utilization around 60 to 80%.
-
Test
Apply the change in a non-production environment or to one instance in a group first.
-
Change and monitor
Apply in production during a suitable window and watch performance and error rates.
-
Record the saving
Note the before and after cost so that the saving can be reported and verified.
Changing an instance's size usually requires a restart, so services without redundancy need a maintenance window. Services behind a load balancer can be resized one instance at a time.
Within a family or across families
The simplest change is to a smaller size in the same instance family. Larger savings often come from changing family: a workload that uses little memory may suit a compute-optimized family, while a memory-bound workload with low CPU may suit a memory-optimized family with fewer CPUs. Moving to a newer generation or to Arm-based processors can add further savings, as the lesson on modernizing compute explains, but needs compatibility testing.
Rightsize before committing
Commitment discounts reduce the rate for a fixed level of usage. If an organization commits to its current, oversized footprint and then rightsizes, the commitment covers capacity that no longer exists and the unused part is wasted for the rest of the term. The usual order is therefore: remove waste, rightsize, then commit to the baseline that remains.
Order of compute optimization
Reading a recommendation
A recommender suggests moving an application server from 8 vCPU / 32 GiB to 2 vCPU / 8 GiB. Over 14 days, average CPU was 6% and peak CPU 22%. No memory metrics were collected. The application is a Java service. Should the engineer apply the recommendation?
Not yet. Without memory data, the recommendation cannot account for the Java heap, which may be set to use most of the 32 GiB. The 14-day window may also miss a monthly peak. The engineer should install the memory agent, collect at least a full month, check the heap configuration, and then choose a size, perhaps 4 vCPU / 16 GiB as an intermediate step, testing before applying in production.
Estimating the saving
A fleet of 20 instances costs USD 0.40 per hour each and runs continuously. Utilization data supports moving to a size that costs USD 0.20 per hour. What is the monthly saving?
Each instance saves USD 0.20 per hour. Over about 730 hours a month, that is USD 146 per instance, or USD 2,920 a month for 20 instances, about USD 35,000 a year. If the fleet is later covered by commitments, the saving is calculated at the committed rate, which is lower, so the two savings must not simply be added.
Why can a recommendation based only on CPU utilization be unsafe?
Show answer
The workload may be memory-bound. Memory usually needs an agent to measure, so without it a recommender may propose a size with too little memory.
Exam Tips
Remember for the exam
- Rightsize with at least two to four weeks of data, using peaks and memory, not average CPU alone.
- Keep headroom above the peak and test before changing production.
- Changing instance family or generation can save more than resizing within a family.
- Rightsize before buying commitments, or the commitment locks in waste.