2

I am using google app engine with nodejs.
I want to limit the number of instances used by app engine. I have tried app.yaml before deploying with gcloud cli but I think it doesn't work...
I have set app.yaml file like following

runtime: nodejs
vm: true
automatic_scaling:
  min_num_instances: 1
  max_num_instances: 3
  cool_down_period_sec: 120 # default value
  cpu_utilization:
    target_utilization: 0.7

But its using 8 instances still at this moment.
How can I decrease the number of instances and control them?

After running gcloud app versions list ,

SERVICE  VERSION          TRAFFIC_SPLIT  LAST_DEPLOYED              SERVING_STATUS
default  20160811t015921  0.00           2016-08-11T02:03:24+09:00  SERVING
default  20160811t022251  0.00           2016-08-11T02:26:20+09:00  SERVING
default  20160811t023404  0.00           2016-08-11T02:36:45+09:00  STOPPED
default  20160811t031525  0.00           2016-08-11T03:17:48+09:00  STOPPED
default  20160811t053241  0.00           2016-08-11T05:35:19+09:00  STOPPED
default  20160817t191913  0.00           2016-08-17T19:21:46+09:00  STOPPED
default  20160817t220352  0.00           2016-08-17T22:06:17+09:00  STOPPED
default  20160818t171126  0.00           2016-08-18T17:14:07+09:00  STOPPED
default  20160820t000714  0.00           2016-08-20T00:10:16+09:00  STOPPED
default  20160820t033731  0.00           2016-08-20T03:39:45+09:00  STOPPED
default  20160821t023159  0.00           2016-08-21T02:34:05+09:00  STOPPED
default  20160821t025235  1.00           2016-08-21T02:55:13+09:00  SERVING

And after running gcloud app instances list,

SERVICE  VERSION          ID  VM_STATUS  DEBUG_MODE
default  20160811t015921  0   RUNNING
default  20160811t015921  1   RUNNING
default  20160811t022251  0   RUNNING
default  20160811t022251  1   RUNNING
default  20160811t022251  2   RUNNING
default  20160811t022251  3   RUNNING
default  20160811t022251  4   RUNNING
default  20160821t025235  0   RUNNING    YES

comes out.

2 Answers2

1

It's a known GAE issue, you may want to star it: https://code.google.com/p/googleappengine/issues/detail?id=12363.

A few workarounds are suggested in the thread or in the links from the thread.

One of them leads to an answer which appears to be a good way of eliminating the need for manually stopping and deleting the undesired instances: How to stop creating extra instances when using google managed vms?

Community
  • 1
  • 1
Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
1

Based on the output of your commands, it looks like you have multiple versions of your application running. Each version will spin up (n) instances based on load, even if they're not receiving traffic.

It looks like version 20160821t025235 is the one you want to keep running. Try doing this:

gcloud app versions stop 20160811t015921 20160811t022251

If you do that, it should stop the other versions.

Justin Beckwith
  • 7,686
  • 1
  • 33
  • 55