why does google appengine deployment take several minutes to update service

Posted on

why does google appengine deployment take several minutes to update service

I’m using nodejs flexible environment documented here

Nothing fancy in the config

runtime: nodejs
vm: true
service: SimpleExpressService
  enable_health_check: False
  min_num_instances: 1
  max_num_instances: 4
  cool_down_period_sec: 120
    target_utilization: 0.5

Here is my deployment command

gcloud app deploy -q --promote --version $VER

Whenever I deploy a new version, almost everything goes really fast. However, the step ‘Updating service [SimpleExpressServer]’ takes several minutes.

Is there anyway to optimize this step?

enter image description here

Solution :

From Deploying your program:

By default the deploy command automatically generates a new version ID
each time that you use it and will route any traffic to the new

To override this behavior, you can specify the version ID with the
version flag:

gcloud app deploy --version myID

You can also specify not to send all traffic to the new version
immediately with the –no-promote flag:

gcloud app deploy --no-promote

So your deployment includes overwriting the specified app version and switching traffic to the newly deployed version.

When you re-deploy a certain version there’s a pile of additional stuff to be done compared to the 1st deployment of that version, which includes at least:

  • switching traffic away from the version being overwritten
  • shutting down the instances running the previous version of the code:
    • determining the scaling type
    • finding out which are the running instances
    • any grace period to complete requests in progress
    • any grace period to complete shutdown hooks (if applicable)
    • sending them the /_ah/stop request
  • decomissioning the old vm instances

Leave a Reply

Your email address will not be published. Required fields are marked *