为什么 google appengine 部署需要几分钟才能更新服务 [英] why does google appengine deployment take several minutes to update service

查看:17
本文介绍了为什么 google appengine 部署需要几分钟才能更新服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用记录在案的 nodejs 灵活环境

解决方案

来自 部署你的程序:

<块引用>

默认情况下,deploy 命令会自动生成一个新的版本 ID每次使用它并将任何流量路由到新的版本.

要覆盖此行为,您可以使用版本标志:

gcloud app deploy --version myID

您也可以指定不将所有流量发送到新版本立即使用 --no-promote 标志:

gcloud app deploy --no-promote

因此,您的部署包括覆盖指定的应用版本并将流量切换到新部署的版本.

当您重新部署某个版本时,与该版本的第一次部署相比,还有一堆附加事情需要完成,其中至少包括:

  • 从被覆盖的版本切换流量
  • 关闭运行先前版本代码的实例:
    • 确定缩放类型
    • 找出哪些是正在运行的实例
    • 用于完成正在进行的请求的任何宽限期
    • 完成关闭挂钩的任何宽限期(如果适用)
    • 向他们发送/_ah/stop请求
  • 停用旧的虚拟机实例

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?

解决方案

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

这篇关于为什么 google appengine 部署需要几分钟才能更新服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆