Setting f1-micro resource limits in app.yaml for g

2020-02-26 05:55发布

Without utilizing the deprecated vm_settings -> machine_type setting, my Google Managed VM deploys as g1-small. Using Node.js app.yaml as a template, what do I need to change besides memory_gb to deploy as an f1-micro machine type? Presently, I have

resources:
  cpu: .5
  memory_gb: .6
  disk_size_gb: 10

and deploy using

gcloud preview app deploy app.yaml --set-default

doing

vm_settings:
  machine_type: f1-micro

...works, but I'm warned that this setting will soon disappear.

2条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-02-26 06:21

As Jeff and Greg both replied, "Google adds a little overhead on the VM before picking a machine type. This is around 400mb of ram. So they told me if you want an f1-micro try requesting .2 or lower memory as Greg mentioned."

I had to drop to .18 to get it to deploy as f1-micro, but the general idea that google is adding overhead is solid.

查看更多
Lonely孤独者°
3楼-- · 2020-02-26 06:30

Just want to update this post. It is now not possible to set the memory to 0.18 as Google has documented how these settings are calculated.

CPU

For cpu, you can now only set 1 or an even number from 2 to 32 (i.e. 2, 4, 6, 8 .. 32)

Memory

For memory_gb, Google states that the minimum memory is 0.9GB per core, which includes ~0.4GB overhead Google processes require. So you can request for 0.5GB and above of memory to meet that requirement. 0.18 would not be applicable anymore, an error would be thrown during deployment.

So my app.yaml looks like this currently:

# [START app_yaml]
runtime: nodejs
env: flex

resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

I know the question was to set up f1-micro resource limits but based on the current documentation, it seems that it's not possible.

Please refer to Resource settings for more details on the calculation. There's even a formula you can follow.

查看更多
登录 后发表回答