Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Compute Engine memory Utilization

I got a "recommendation" to add more memory to my 1 vCPU, 1.75 GB Google Compute Engine instance. I added a GB, and all is quiet.

However it has increased my overall cost about 50% (if I am reading it right - a task in and of itself), and I'd like to know what my memory utilization is.

I see it tracking CPU, Disk, and network, but not memory. I looked at the monitoring options and don't see memory as an option for GCE.

How do I monitor memory over time? I want to make sure I am running efficiently AND cheaply.

( see this question never got answered Memory usage metric identifier Google Compute Engine)

like image 707
ed4becky Avatar asked Jun 22 '26 06:06

ed4becky


1 Answers

There are a couple of methods you could use to monitor the memory usage of a Compute Engine instance.

The first involves the use of the Stackdriver Monitoring Agent. This can be installed on the instance, and provides additional metrics including memory usage. For more information on this please see here.

Alternatively you could use a more 'Linux-esque' approach. For example, you could use the watch command to track used/free memory at intervals and output this to a file. The following command would allow you to do this:

watch -n 2 free 'wc -l my.log | tee -a memory.log'

This would create an output file ('memory.log') displaying your memory usage at 2 seconds intervals (To change the interval, change the number 2 to however many seconds you require).

like image 177
neilH Avatar answered Jun 25 '26 04:06

neilH