custom machine types: how to calculate minimum memory requirements?

185 views
Skip to first unread message

Steve Lorimer

unread,
Nov 28, 2018, 3:36:00 PM11/28/18
to gce-dis...@googlegroups.com
Hi all

I am trying to come up with a formula for calculating the minimum memory requirements when specifying a custom machine type.

I have been unable to find documentation, but by playing with the custom machine type I found the following:

for 2 vCPUs, memory must be at least 1.8GB (ie: 2 * 0.9)
for 4 vCPUs, memory must be at least 3.6GB (ie: 4 * 0.9)
for 6 vCPUs, memory must be at least 5.5GB (ie: 6 * 0.916666667) what???
for 8 vCPUs, memory must be at least 7.2GB (ie: 8 * 0.9)
for 10 vCPUs, memory must be at least 10GB (ie: 10 * 0.9)

Why the anomaly for 6 vCPUs?

I have confirmed that using the setMachineType api I also get some strange results.

For 4 vCPUs, I put 3686 MB of memory (.9*1024*4 = 3686.4) - this works.
For 6 vCPUs, I put 5529 MB of memory (.9*1024*6 = 5529.6) - this fails.
For 8 vCPUs, I put 7372 MB of memory (.9*1024*8 = 7372.8) - this fails, but rounding up to 7373 MB works!

The error message coming back from the API says memory must be specified in multiples of 256MB, but 3686MB (the value which works for 4 vCPUs) is not a multiple of 256MB - so why does that work?

I can't get my head around the rules. Does anyone know what are they please?

TIA
Steve

Sunny J (Google Cloud Support)

unread,
Nov 28, 2018, 8:18:25 PM11/28/18
to gce-discussion
Hi Steve, 

You seem to be on the right path, of multiplying how many vCPUs you have by 0.9. However it seems like the calculations are not adding up properly. Ex. 6 vCPUs * 0.9 should return 5.4 and not 5.5. Error "memory must be specified in multiples of 256 MB suggest an invalid because the total memory must be a multiple of 256MB and as per my calculation 7373/8 = 921.626 and divide by 0.9, you will have 1024.027 which is not correct. Calculating backwards, with the actual number 7372.8/8 = 921.6 and divide by .9, returns 10243. There are a couple of examples in this documentation, for invalid and valid machine types, I would recommend that you review them. Also note that memory per vCPU of a custom machine type must be between 0.9 GB and 6.5 GB per vCPU, inclusive.

Hope this is helpful. 
Reply all
Reply to author
Forward
0 new messages