首页 > 解决方案 > JAVA GAE:进程终止,因为机器被强制关闭

问题描述

我的 java 应用程序在 GAE 上运行了很长时间。今天应用程序返回了 500 并且 appengine 日志只显示了以下消息:

"Process terminated because the machine was forced to shutdown" 

我找不到任何解释该消息原因的文档。

关于关机生命周期的唯一文档是https://cloud.google.com/appengine/docs/standard/java/how-instances-are-managed#shutdown

Shutdown

The shutdown process might be triggered by a variety of planned and unplanned events, such as:

    You manually stop an instance.
    You deploy an updated version to the service.
    The instance exceeds the maximum memory for its configured instance_class.
    Your application runs out of Instance Hours quota.
    Your instance is moved to a different machine, either because the current machine that is running the instance is restarted, or App Engine moved your instance to improve load distribution.

好吧,唯一合理的原因是最后一个,但是,我不相信消息是指“应用引擎移动了您的实例......”

我的应用程序配置:

<instance-class>B4_HIGHMEM</instance-class>
<runtime>java8</runtime>
<basic-scaling>
    <max-instances>1</max-instances>
    <idle-timeout>1m</idle-timeout>
</basic-scaling>

任何的想法?问候

标签: javagoogle-app-enginegoogle-cloud-platform

解决方案


不确定为什么它会在您的 GAE 中发生,但是,根据App Engine 服务水平协议,GAE 承诺的每月正常运行时间百分比为“至少 99.95%”

“每月正常运行时间百分比”是指一个月内的总分钟数,减去一个月内所有停机时间段遭受的停机时间的分钟数,再除以一个月内的总分钟数。

因此,这可能是一种预期行为,但是,如果您认为这种情况发生得更频繁,我建议您联系 GCP 技术支持以进行更详细的检查。


此外,您可能希望增加应用配置中的max-instances参数,因为更多实例将有助于更好的加载过程,因此如果一个实例失败,其他实例将继续工作。


推荐阅读