Optimize underprovisioned AlloyDB clusters

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:

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:

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

    For more information, see Exploring recommendations.

  2. 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 as us-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 as us-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

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. 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 usage
    • HIGH_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 usage
    • HIGH_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:

  1. Click Edit on your cluster.
  2. 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.

  3. Click Update instance.

What's next