Search code examples
ruby-on-railsgoogle-app-enginememory

How to find available memory on a google app engine flex instance


I tested with different instance class options and checked the available memory with the free -h command via SSH, the available memory doesn't change, it gives me the same 988Mi available.

Is there another way to check the available memory or why is it not giving me more memory when I change the instance class?

This is my configuration file:

entrypoint: bundle exec rails server -p 8080
env: flex
runtime: ruby
instance_class: B4_1G
manual_scaling:
  instances: 1 

Solution

  • The tag instance_class should be only available for Google App Engine Standard deployments, as stated in the app.yaml reference, but it is not mentioned in the Flexible app.yaml reference.

    This is an issue reported to Google here, but it seems is not fixed yet. According to this, when that tag is used a default machine with 1GB is created. Which matches your situation.

    The correct way to assign resources in Flexible is by using the tag resources. See the reference for more info. Here is an example:

    runtime: nodejs
    env: flex
    
    # This sample incurs costs to run on the App Engine flexible environment.
    # The settings below are to reduce costs during testing and are not appropriate
    # for production use. For more information, see:
    # https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml
    manual_scaling:
       instances: 1
    resources:
       cpu: 1
       memory_gb: 0.5
       disk_size_gb: 10