Compute Engine provides machine type recommendations to help you use the resources in your managed instance groups more efficiently. The Google Stackdriver Monitoring service generates these recommendations based on system metrics that it gathers. Use these recommendations to decide if you should resize the machine type of your instances to add or remove vCPU and memory resources.
To learn more about the different sizing options available to VM instances, read the Machine Types documentation.
Sizing Recommendations are also known as Rightsizing Recommendations.
Before you begin
- Read the Google Cloud Platform Console documentation.
Recommendations are available for single-zone, non-autoscaled, non-load balanced managed instance groups.
During Beta, sizing recommendations are available free of charge. However, Google might charge for this feature in future releases.
Metrics used for sizing recommendations
Compute Engine monitors the CPU and memory utilization of running virtual machines and makes recommendations using the last 8 days of data. In order to recommend the best single machine type for all instances in a managed instance group, Compute Engine generates a standard sizing recommendation for individual instances and, after adjusting for outliers, chooses a machine type that does not undersize any single VM instance. Any instances that are not running, such as stopped or restarting VM instances, are not included in the calculation.
Compute Engine might make a recommendation if:
- Your instance group has had low CPU utilization most of the time. Compute Engine will recommend a machine type with fewer virtual CPUs.
- Your instance group has had high CPU utilization most of the time. Compute Engine will recommend a machine type with more virtual CPUs.
- Your instance group has not used a large fraction of its memory. Compute Engine will recommend a machine type with less memory.
- Your instance group has actively been using a large fraction of its memory most of the time. Compute Engine will recommend a machine type with more memory.
Compute Engine might make recommendations to use either a standard or custom machine type. Note that there are some limitations in the amount of memory and vCPU available to a machine. In particular, increasing one resource might require increasing the other at the same time, to follow the specifications of a valid machine type. Also, Compute Engine will only recommend machine types that are available in the zone where the instance is running.
See Custom Machine Type specifications for details.
If the workload for the managed instance group is very different across individual instances, some instances might be oversized so that the fully utilized instances have enough resources according to the recommendation. For example, Compute Engine might make the following recommendation to support the workload of instance 4 even though instances 1, 2, 3, and 5 will be oversized and underutilized:
For this reason, recommendations for managed instance group work best when the instances have a reasonably distributed workload.
For cost difference estimations, the cost of an instance group is based on the previous week's usage (before sustained use discount) and is extrapolated to 30 days. This is then compared to the recommended machine type monthly cost (before sustained use discount). For accurate pricing and details, read the Pricing documentation.
Workloads for sizing recommendations
You can take advantage of sizing recommendations if you have the following workloads:
- Workloads with periodic increases and decreases in traffic, such as workloads susceptible to seasonal traffic.
- Workloads that are underutilized in CPU and RAM because they are bounded by other limitations, such as read-write throughput.
- Workloads that run software that requires individual software licenses and cannot afford to add more instances; in this case, you might rely on sizing recommendations to scale your resources while keeping the number of VM instances constant.
- Workloads that are unable to dynamically adapt to a changing number of instances, such as workloads that are not a good fit for autoscaling.
You might not want to use sizing recommendations if you have workloads that see very limited spikes where a recommendation would not be generated quickly enough to be useful or if you have managed instance groups where each instance handles a drastically different workload, creating recommendations that would oversize most VM instances in the group.
Viewing sizing recommendations
Compute Engine makes recommendations through the Google Cloud Platform Console. Recommendations are turned on by default, but if you need to toggle recommendations on or off, follow these instructions.
- Go to the Instance groups page.
- Select your project and click Continue.
Look at the Recommendation column to review recommendations for individual managed instance groups. You can also sort the column by amount of estimated savings. If there are no recommendations next to the instance groups, Compute Engine does not have any recommendations to make.
If your instance group has two instance templates, Compute Engine will provide recommendations for each instance template. Click a recommendation to view recommendations for the respective instance template.
When you create a new managed instance group, recommendations for the new group will appear 24 hours after the instance has been created.
Afterwards, recommendations are refreshed at regular intervals throughout the day.
Applying recommendations to instance groups
If you want to apply the recommendations made by Compute Engine, you can resize the instances in the group directly from the recommendations screen.
When you apply a recommendation to a managed instance group, Compute Engine will:
- Clone the instance templates being used by the managed instance group.
- Modify the cloned instance templates based on the recommendations and any changes you make.
Use the Managed Instance Group Updater to apply the new template. If the instance group has two instance templates:
- You can only apply recommendations for one instance template at a time.
- A managed instance group can maintain at most two instance templates at a time so it is not possible to canary a recommendation while still maintaining two other instance templates. However, you could canary a recommendation if your instance group only has one instance template.
To apply a recommendation:
On the Instance Groups instances page, click the recommendation text for the instance group that you want to update.
A popup appears with more details and a choice to Cancel, Dismiss Recommendation, or Continue. To review and apply the recommendation, click Continue.
On the next screen, the recommendation is explained in detail. If you move forward with the recommendation, Compute Engine will create a new instance template and update all instances in the instance group to use the new template.
(Advanced) If you want to customize how the new template is rolled out to your instances, click Customize deployment. A new screen appears.
- Under Template, you can choose whether to apply the new template to 100% of instances in the instance group or to only a subset of the instances.
- Under Update mode, you can choose whether Compute Engine will actively delete and create new instances using the new instance template (Proactive) or if Compute Engine will only apply the update if the instance is created by other means, such as a resize or when a new instance is added to the group (Opportunistic).
- Under Maximum surge, you can choose how many temporary extra instances to create above the managed instance group's target size. The more instances you allow, the faster your update will be, at the cost of additional instances. The default is 1 additional instance.
- Under Maximum unavailable, you can choose how many instances are allowed to be offline at a time during this update. This number also includes any instances that are unavailable for other reasons. For example, if the instance group is in the process of being resized up, instances in the middle of being created might be unavailable; these instances would count towards this number. The default is 1 instance can be unavailable at a time.
- Under Minimum wait time, you can choose how many seconds to wait before marking a newly created instance as updated. The time starts after a successful health check. Use this feature to control the rate at which the instance template is applied.
Click the Save button to apply the changes.
When you are ready, click Deploy to deploy the changes.
If you are done with a recommendation, you can dismiss it. Dismissing removes a recommendation from the total savings estimate and also minimizes the appearance of the recommendation by turning the recommendation gray.
To dismiss a single recommendation:
- On the Instance Groups page, click the recommendation text you want to dismiss.
- A popup appears with more details and a Dismiss recommendation button.
- Click Dismiss recommendation.
To dismiss all recommendations, click the Dismiss all button on the Instance groups page.
To restore a recommendation:
On the Instance groups page, click the gray recommendation text you want to restore.
A popup appears with more details and a Restore recommendation button.
Click Restore recommendation.
Using the Monitoring Agent for more precise recommendations
Stackdriver offers a Monitoring Agent that collects additional disk, CPU, network, and process metrics from your VM instances. You can install the monitoring agent on your VM instances so it can access system resources and application services to collect this data.
If the monitoring agent is installed and running on a VM instance, the CPU and memory metrics collected by the agent are automatically used to compute sizing recommendations. The agent metrics provided by the monitoring agent give better insights into resource utilization of the instance than the default Compute Engine metrics. This allows the recommendation engine to estimate resource requirements better and make more precise recommendations.
To install the agent, see Installing the Monitoring Agent.
During Beta, you can email feedback to the Sizing recommendations discussion group.