6

Problem:

I am deploying an appengine standard service - nodejsv10. However after the traffic is migrated to the new version, the old version is still left running with the instance count being listed as 2 or 1. This is still the case for multiple deployments over the past week that have not received traffic for well over 24 hours (so I don't think it's a console delayed refresh issue).

I don't want to be billed for these instances as I don't need them. And manually having to delete these old version seems like a silly user experience.

Deployment command: gcloud beta app deploy

app.yaml

env: standard
instance_class: F4
inbound_services:
  - warmup
automatic_scaling:
  min_idle_instances: 1
  max_idle_instances: 1
  min_pending_latency: automatic
  max_pending_latency: automatic
  max_concurrent_requests: 15
  min_instances: 1

2 Answers2

2

After reading the documentation more, I think I found the fix. I removed min_instances and left in min_idle_instances. Since min_instances forces the instances to be live regardless of traffic, and min_idle_instances only applies to the version receiving most of the traffic. I am testing this, will report back if this does not work.

https://cloud.google.com/appengine/docs/standard/nodejs/config/appref#automatic_scaling

min_instances

The minimum number of instances for App Engine to create for this module version. These instances serve traffic when requests arrive, and continue to serve traffic even when additional instances are started up as required to handle traffic. Note that you are charged for the number of instances specified whether they are receiving traffic or not.

min_idle_instances

The number of instances to be kept running and ready to serve traffic. Note that you are charged for the number of instances specified whether they are receiving traffic or not. This setting only applies to the version that receives most of the traffic.

1

App Engine standard instances can not be stopped as mentioned here unless you are using either Manual or Basic Scaling. This would mean that if for some reason someone is able to reach the URL of your previous version, it will start an instance in order to serve said request.

My recommendation would be to change to a different type of scaling (personally I would choose Basic Scaling for your case) as you would be able to stop the instances. Otherwise, you would have to delete the previous versions or run the risk of an instance running on an old version without your knowledge due to some random request to an older version.

Hope you find this information helpful.

rsalinas
  • 156
  • 3