google-app-engineapp.yamlgoogle-appengine-node

App Engine Standard Nodejs8 ignore memory_gb in resources


I'm trying to deploy a Nodejs8, memory intense app on Google App Engine Standard.

This is my app.yaml:

runtime: nodejs8
resources:
  cpu: 1
  memory_gb: 6
  disk_size_gb: 10

This is my deploy command:
gcloud app deploy --project=my-project --version=0-0-12

This is the error I get when I try to access the relevant endpoint of the app:
Exceeded soft memory limit of 128 MB with 182 MB after servicing 0 requests total. Consider setting a larger instance class in app.yaml.

How come the memory_gb param is ignored? What do I need to do in order to enlarge the memory of the instances?


Solution

  • You're attempting to use flexible environment Resource settings into a standard environment app.yaml file, which won't work. Note that in most cases the invalid settings will be silently ignored, so you need to be careful.

    For the standard environment you can't explicitly pick individual resources, you can only use the instance_class option in Runtime and app elements:

    instance_class

    Optional. The instance class for this service.

    The following values are available depending on your service's scaling:

    • Automatic scaling

      F1, F2, F4, F4_1G

      Default: F1 is assigned if you do not specify an instance class along with the automatic_scaling element.

    • Basic and manual scaling

      B1, B2, B4, B4_1G, B8

      Default: B2 is assigned if you do not specify an instance class along with the basic_scaling element or the manual_scaling element.

    Note: If instance_class is set to F2 or higher, you can optimize your instances by setting max_concurrent_requests to a value higher than 10, which is the default. To find the optimal value, gradually increase it and monitor the performance of your application.

    The max amount of memory available in the currently supported standard environment instance classes is 1G, if you actually need 6G you'll have to migrate to the flexible environment.

    Side note: potentially useful: How to tell if a Google App Engine documentation page applies to the standard or the flexible environment