在 App Engine Google 云中部署失败
Failed Deployment in App Engine Google Cloud
我正在 google 云应用引擎中部署我的 nodejs 应用程序,但出现错误
此请求导致为您的应用程序启动一个新进程,从而导致首次加载您的应用程序代码。
因此,与您的应用程序的典型请求相比,此请求可能需要更长的时间并使用更多 CPU。 -- 发出请求时。
我也看到了一些 Whosebug 的答案,但它们对我不起作用。
我的app.yaml有这个配置
运行时:nodejs10
谁能帮帮我
您可以将以下内容添加到您的app.yaml:
inbound_services:
- warmup
然后实施一个处理程序来捕获所有预热请求,这样您的应用程序就不会获得全部负载。给出了完整的解释 here. Another detailed post about this topic can be found .
此外,您还可以添加自动缩放选项。您可以尝试一下这些来找到最适合您的应用程序。与延迟相关的变量尤其重要。值得一提的是,它们可以在标准 GAE 环境中设置。
automatic_scaling:
min_idle_instances: automatic
max_idle_instances: automatic
min_pending_latency: automatic
max_pending_latency: automatic
可以找到更多缩放选项 here。
"request caused a new process to be started" 通知通常在您的应用程序中没有预热请求时发生。
您能否尝试实现一个仅在应用程序预热时 returns 处于就绪状态的健康检查处理程序。这将使您的服务在准备就绪之前不会接收流量。
Warning: Legacy health checks using the /_ah/health path are now
deprecated, and you should migrate to use split health checks.
在这里你可以找到 Split health checks for Nodejs
活性检查
Liveness checks confirm that the VM and the Docker container are
running. Instances that are deemed unhealthy are restarted.
path: "/liveness_check"
check_interval_sec: 30
timeout_sec: 4
failure_threshold: 2
success_threshold: 2
准备情况检查
Readiness checks confirm that an instance can accept incoming
requests. Instances that don't pass the readiness check are not added
to the pool of available instances.
path: "/readiness_check"
check_interval_sec: 5
timeout_sec: 4
failure_threshold: 2
success_threshold: 2
app_start_timeout_sec: 300
编辑
对于 App Engine Standard,它无法为您提供灵活性,导致提前终止或频繁重启的硬件和软件故障可能会在没有事先警告的情况下发生。 link
App Engine attempts to keep manual and basic scaling instances running
indefinitely. However, at this time there is no guaranteed uptime for
manual and basic scaling instances. Hardware and software failures
that cause early termination or frequent restarts can occur without
prior warning and can take considerable time to resolve; thus, you
should construct your application in a way that tolerates these
failures.
Here are some good strategies for avoiding downtime due to instance
restarts:
Reduce the amount of time it takes for your instances restart or for
new ones to start.
For long-running computations, periodically create
checkpoints so that you can resume from that state.
Your app should be "stateless" so that nothing is stored on the instance.
Use queues for performing asynchronous task execution.
If you configure your instances to manual scaling: Use load balancing across > multiple instances. Configure more instances than required to handle normal
traffic. Write fall-back logic that uses cached results when a manual
scaling instance is unavailable.
我正在 google 云应用引擎中部署我的 nodejs 应用程序,但出现错误 此请求导致为您的应用程序启动一个新进程,从而导致首次加载您的应用程序代码。 因此,与您的应用程序的典型请求相比,此请求可能需要更长的时间并使用更多 CPU。 -- 发出请求时。
我也看到了一些 Whosebug 的答案,但它们对我不起作用。
我的app.yaml有这个配置
运行时:nodejs10
谁能帮帮我
您可以将以下内容添加到您的app.yaml:
inbound_services:
- warmup
然后实施一个处理程序来捕获所有预热请求,这样您的应用程序就不会获得全部负载。给出了完整的解释 here. Another detailed post about this topic can be found
此外,您还可以添加自动缩放选项。您可以尝试一下这些来找到最适合您的应用程序。与延迟相关的变量尤其重要。值得一提的是,它们可以在标准 GAE 环境中设置。
automatic_scaling:
min_idle_instances: automatic
max_idle_instances: automatic
min_pending_latency: automatic
max_pending_latency: automatic
可以找到更多缩放选项 here。
"request caused a new process to be started" 通知通常在您的应用程序中没有预热请求时发生。
您能否尝试实现一个仅在应用程序预热时 returns 处于就绪状态的健康检查处理程序。这将使您的服务在准备就绪之前不会接收流量。
Warning: Legacy health checks using the /_ah/health path are now deprecated, and you should migrate to use split health checks.
在这里你可以找到 Split health checks for Nodejs
活性检查
Liveness checks confirm that the VM and the Docker container are running. Instances that are deemed unhealthy are restarted.
path: "/liveness_check"
check_interval_sec: 30
timeout_sec: 4
failure_threshold: 2
success_threshold: 2
准备情况检查
Readiness checks confirm that an instance can accept incoming requests. Instances that don't pass the readiness check are not added to the pool of available instances.
path: "/readiness_check"
check_interval_sec: 5
timeout_sec: 4
failure_threshold: 2
success_threshold: 2
app_start_timeout_sec: 300
编辑
对于 App Engine Standard,它无法为您提供灵活性,导致提前终止或频繁重启的硬件和软件故障可能会在没有事先警告的情况下发生。 link
App Engine attempts to keep manual and basic scaling instances running indefinitely. However, at this time there is no guaranteed uptime for manual and basic scaling instances. Hardware and software failures that cause early termination or frequent restarts can occur without prior warning and can take considerable time to resolve; thus, you should construct your application in a way that tolerates these failures.
Here are some good strategies for avoiding downtime due to instance restarts:
Reduce the amount of time it takes for your instances restart or for new ones to start.
For long-running computations, periodically create checkpoints so that you can resume from that state.
Your app should be "stateless" so that nothing is stored on the instance.
Use queues for performing asynchronous task execution.
If you configure your instances to manual scaling: Use load balancing across > multiple instances. Configure more instances than required to handle normal traffic. Write fall-back logic that uses cached results when a manual scaling instance is unavailable.