17

I'm using nodejs flexible environment documented here

Nothing fancy in the config

runtime: nodejs
vm: true
service: SimpleExpressService
health_check:
  enable_health_check: False
automatic_scaling:
  min_num_instances: 1
  max_num_instances: 4
  cool_down_period_sec: 120
  cpu_utilization:
    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

Sahas
  • 3,046
  • 6
  • 32
  • 53

1 Answers1

12

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 version.

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
Carl Manaster
  • 39,912
  • 17
  • 102
  • 155
Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
  • Thanks. I understand the process, so, this 10+ mins to do all these is set in stone or are there any config settings that can help us to shorten the time? – Sahas Oct 24 '16 at 14:37
  • None that I know of. – Dan Cornilescu Oct 24 '16 at 14:47
  • There is literally no reason for this step to be so long. now.sh does it in under 30s!! https://twitter.com/rauchg/status/834222303105867777 – stanm87 Mar 18 '17 at 15:54
  • @stanm87 That may be true for *that particular* app case at *that time*. But it doesn't mean it's always gonna take ~30s for *every other* app deployment. – Dan Cornilescu Mar 18 '17 at 17:53
  • 9
    @DanCornilescu of course, but GAE doesn't have any case at any time that is that fast. GAE baseline is 7min to just to update a freakin service, that runs on 1 smallest machine (manual scaling), without any building (docker image already built and pushed to their registry) – stanm87 Mar 19 '17 at 12:24
  • 2
    @stanm87 That may be true, but it is, after all, just hearsay - unless (you actually work there and) you *know exactly* the details of everything that can be happening in the GAE infra at deployment time. – Dan Cornilescu Mar 19 '17 at 12:38
  • Or if there is an SLA documenting a minimum (or maybe even a typical or max) deployment type figure. – Dan Cornilescu Mar 19 '17 at 12:41
  • Deployment time on GCP is still very slow ? No new options ? I tried Azure AppServices and it deploys immediately after copying (0 seconds). Deployment time on GCP is one of the weaknesses – Cesar Oct 21 '19 at 19:43