Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud SQL Database - Memory Utilization - Shared Core Incorrect

Hi,
I have noticed that when setting up a micro instance with a shared core the cloudsql.googleapis.com/database/memory/utilization metric displays the incorrect value for the memory utilisation. An instance with 90% free memory cloudsql.googleapis.com/database/memory/components displays high memory utilization. I have only tested on Postgres instances and it seems to only be the case with shared core instances.
Is this intended? 

Solved Solved
0 2 1,138
1 ACCEPTED SOLUTION

Yes, the behavior you observed is expected. For shared-core instances in Google Cloud's Cloud SQL, the cloudsql.googleapis.com/database/memory/utilization metric might not always provide an accurate representation of memory utilization. This is due to the nature of shared-core instances where the CPU, and consequently the memory, is shared with other instances. As a result, the actual memory available to a specific database can vary based on the workloads of other instances sharing the same CPU.

For a more precise insight into memory usage, it's recommended to refer to the cloudsql.googleapis.com/database/memory/components metric. This metric provides a detailed breakdown of the database's actual memory consumption, including elements like buffers and caches. Unlike the utilization metric, it offers a clearer picture of memory usage without the influence of shared CPU dynamics.

If you're keen on closely monitoring the memory performance of your micro instance with a shared core, the cloudsql.googleapis.com/database/memory/components metric would be the go-to. For more consistent memory performance, you might also consider upgrading to a larger instance size.

View solution in original post

2 REPLIES 2

Yes, the behavior you observed is expected. For shared-core instances in Google Cloud's Cloud SQL, the cloudsql.googleapis.com/database/memory/utilization metric might not always provide an accurate representation of memory utilization. This is due to the nature of shared-core instances where the CPU, and consequently the memory, is shared with other instances. As a result, the actual memory available to a specific database can vary based on the workloads of other instances sharing the same CPU.

For a more precise insight into memory usage, it's recommended to refer to the cloudsql.googleapis.com/database/memory/components metric. This metric provides a detailed breakdown of the database's actual memory consumption, including elements like buffers and caches. Unlike the utilization metric, it offers a clearer picture of memory usage without the influence of shared CPU dynamics.

If you're keen on closely monitoring the memory performance of your micro instance with a shared core, the cloudsql.googleapis.com/database/memory/components metric would be the go-to. For more consistent memory performance, you might also consider upgrading to a larger instance size.

Greetings! Your answer is very helpful. I wanted to ask, is this the case for CPU Utilization as well? The utilization I see is at 20% or so yet GCP flags this as an underprovisioned resource. There are three databases, two are at around 20% CPU utilization and one is at 10%.  The instance is 1 vCPU, 0.614 GB.