我们的应用程序广泛依赖 backend instances 。有一些逻辑必须每隔几秒运行一次。此代码的执行不能仅由到达前端的请求驱动,因为无论如何它都需要运行。
我们只考虑使用task queues来解决这个问题。但据我们所知,任务队列只能保证任务在24小时内执行。不过,我还没有找到支持这一点的引用资料。
我们的应用程序使用固定数量的 resident B1后端实例。我们假设每个实例在后端版本部署并启动后24/7都保持 Activity 状态。
- 这是一个有效的假设吗?如果没有,每次后端实例关闭时我们的应用程序都能收到通知吗?
- 关于后端实例可用性的 SLA 是什么?
- 后端实例终止后是否会自动重新启动?例如。实例内存不足后是否自动重启?
- 如果实例全部终止,需要多长时间才能再次启动?
- 我们在每个后端实例上创建一个固定大小的线程池。后端实例上的线程池是否有最大大小?
- 还有其他情况可能导致后端实例终止吗?
谢谢!
更新
App Engine attempts to keep backends running indefinitely. However, at this time there is no guaranteed uptime for backends.
- 那么正常运行时间的 SLA 是多少?我正在寻找这样的声明:“后端的保证正常运行时间为 99.99%”
The App Engine team will provide more guidance on expected backend uptime as statistics become available.
- 此统计信息何时可用?
It's also important to recognize that the shutdown hook is not always able to run before a backend terminates. In rare cases, an outage can occur that prevents App Engine from providing 30 seconds of shutdown time.
When App Engine needs to turn down a backend instance, existing requests are given 30 seconds to complete, and new requests immediately return 404.
The following code sample demonstrates a basic shutdown hook:
LifecycleManager.getInstance().setShutdownHook(new ShutdownHook() {
public void shutdown() {
LifecycleManager.getInstance().interruptAllRequests();
}
});
最佳答案
我只运行一个常驻(非动态)后端实例,我的经验是它每天至少重新启动一次。 您的应用程序必须能够存储其状态并在重新启动后恢复。
关于java - Google App Engine 中常驻后端实例的可用性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16325756/