The underprovisioned cluster recommender helps you detect clusters that have high CPU and/or memory utilization. It then provides recommendations for how to optimize the cluster. This page describes how this recommender works and how to use it.
How it works
When there is high CPU and/or memory utilization detected, you see a recommendation to increase the size of the affected instance in the cluster to reduce CPU and/or memory utilization at peak. Recommendations are generated daily.
Before you begin
Before you can view recommendations and insights, do the following:
Ensure that you enable the Recommender API.
To get the permissions to view and work with insights and recommendations, ensure that you have the required Identity and Access Management (IAM) roles.
Tasks Roles View recommendations recommender.alloydbViewer
oralloydb.viewer
Apply recommendations recommender.alloydbAdmin
oralloydb.admin
See Grant access to other users for more information.
List underprovisioned cluster recommendations
You can list recommendations for underprovisioned clusters
using the Google Cloud console, gcloud CLI
, or the Recommender API.
Console
To list recommendations about underprovisioned clusters, complete the following steps:
In the Google Cloud console, go to the Clusters page.
For more information, see Exploring recommendations.
In the Performance card, click Underprovisioned primary instance.
A list of clusters to which the Underprovisioned primary instance recommendation applies is displayed.
gcloud CLI
To list recommendations about underprovisioned clusters using gcloud CLI, run the gcloud recommender recommendations list
command as follows:
gcloud recommender recommendations list \ --project=PROJECT_ID \ --location=LOCATION \ --recommender=google.alloydb.cluster.PerformanceRecommender \ --filter=recommenderSubtype=INCREASE_PRIMARY_INSTANCE_SIZE
Replace the following:
PROJECT_ID
: Your project ID.LOCATION
: A region where your clusters are located, such asus-central1
.
API
To list recommendations for underprovisioned clusters using the Recommendations API, call the
recommendations.list
method as follows:
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.alloydb.cluster.PerformanceRecommender/recommendations?filter=recommenderSubtype=INCREASE_PRIMARY_INSTANCE_SIZE
Replace the following:
PROJECT_ID
: Your project ID.LOCATION
: A region where your clusters are located, such asus-central1
.
View insights and detailed recommendations
You can view insights and detailed recommendations about underprovisioned clusters
that require optimization using the Google Cloud console,
gcloud CLI
, or the Recommender API.
Console
In the Google Cloud console, go to the Clusters page.
Click the recommendation button for a cluster in the Issues column.
The recommendation panel appears, which contains insights and detailed recommendations about an underprovisioned cluster.
gcloud CLI
Run the gcloud recommender insights list
command as follows:
gcloud recommender insights list \ --project=PROJECT_ID \ --location=LOCATION \ --insight-type=google.alloydb.cluster.PerformanceInsight --filter=insightSubtype=INSIGHT_SUBTYPE
Replace the following:
- PROJECT_ID: Your project ID.
- LOCATION : A region where your clusters are located, such as
us-central1
. - INSIGHT_SUBTYPE: set this parameter to one of the following:
HIGH_INSTANCE_CPU_UTILIZATION
: display insights about CPU usageHIGH_INSTANCE_MEMORY_UTILIZATION
: display insights about memory
API
Call the insights.list
method as follows:
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.alloydb.cluster.PerformanceInsight/insights?filter=insightSubtype=INSIGHT_SUBTYPE
Replace the following:
- PROJECT_ID: Your project ID.
- LOCATION: A region where your clusters are located, for example,
us-central1
. - INSIGHT_SUBTYPE: set this parameter to one of the following:
HIGH_INSTANCE_CPU_UTILIZATION
: display insights about CPU usageHIGH_INSTANCE_MEMORY_UTILIZATION
: display insights about memory
The following table lists the insights and recommendations that the AlloyDB for PostgreSQL
underprovisioned cluster recommender might generate to help you avoid bottlenecks from high CPU and memory
usage and minimize the likelihood of out-of-memory events.
The subtypes are visible in the gcloud
and API results.
Insights | Recommendations |
---|---|
Based on the current CPU utilization trends, the cluster is flagged as
having high CPU usage. Subtype: HIGH_INSTANCE_CPU_UTILIZATION |
Increase CPU size or reduce CPU utilization. Subtype: INCREASE_PRIMARY_INSTANCE_SIZE |
Based on the current memory utilization trends, the cluster is flagged
as having high memory usage. Subtype: HIGH_INSTANCE_MEMORY_UTILIZATION |
Increase memory size or reduce memory utilization. Subtype: INCREASE_PRIMARY_INSTANCE_SIZE |
Apply recommendations
Evaluate the recommendations carefully and do the following in the Google Cloud console to implement the recommendation:
- Click Edit on your cluster.
In the Edit primary instance window, switch to a machine type with more vCPUs and more memory. You don't need to rightsize the cluster exactly as recommended. Use your judgement and resize based on how you intend to provision the cluster.
Click Update instance.