I launched a cloud sql instance with 2 vcpu’s and 8 GB RAM. What is surprising is that at the base IDLE state with no connections from any client the memory components graph shows ~38 percent usage. And surprisingly this percentage retains even if i scale up the instance to 4 vcpu’s and 16GB RAM. What is this base usage and how is it related to the machine paramters. Thanks
Hi @vikrantgupta25 ,
Welcome to Google Cloud Community!
If you’re seeing around 38% memory usage on your Cloud SQL instance even when it’s idle, that’s expected — depending on which metric you’re looking at in Cloud Monitoring.
When you check database/memory/usage or the “Memory usage” chart, you’re viewing memory used at the VM level, excluding the OS page cache. But if you look at database/memory/components or the “Memory components” chart, it breaks memory into three parts: usage, cache, and free.
- Usage is memory used by the database engine for things like planning, execution, and buffer pools. It stays allocated even without traffic — for example, hugepages in PostgreSQL always show up here.
- Cache is the OS-level page cache that speeds up disk access and can be reclaimed if needed, so 100% usage isn’t a problem if enough (20%+) is in cache.
- Free is simply unused memory not yet touched by the database or OS.
To sum it up, that 38% you’re seeing is normal. It’s the database engine reserving memory to stay efficient, and not a sign of a memory leak or issue.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.
Hi @mcbsalceda , thank you for reaching out. Really appreciate the help.
So there are three metrics of interest here -
database/memory/usage → this is the total memory usage for the underlying VM ( this value for me is roughly around 3.5GB for a 2vcpu 8GB machine.
database/memory/components → this is the memory breakdown for the database process. This graph for me shows 38 percent usage in the idle state. My understanding here was that the database generally keeps shared buffer at 30 percent of the available memory hence it might be using the same.
database/memory/total_usage → this metrics report the memory usage for the database process including cache and buffer, But this value is around 0.3GB in idle state. so the assumption i had due to the 2nd metric fails here because i assumed that i should be able to check that usage in the database memory atleast.
So my concern being why is this 38 percent usage and what is it actually used for ?