简体   繁体   English

如何使用 NodeJs 实现 Google App 引擎冗余

[英]How to achieve Google App engine redundancy with NodeJs

I have a NodeJs project on app engine (GAE) .我在应用引擎 (GAE) 上有一个 NodeJs 项目。

Whenever there is an unexpected crash in a service call the NodeJs has to restart (I believe this is normal) , however, this leaves the whole server unaivailable for a couple of seconds which may affect other users.每当服务调用中出现意外崩溃时,NodeJs 必须重新启动(我相信这是正常的),但是,这会使整个服务器在几秒钟内无法使用,这可能会影响其他用户。

I was thinking on creating two instances of the server so that if one instance fails, the other can still attend the requests.我正在考虑创建服务器的两个实例,以便如果一个实例失败,另一个仍然可以处理请求。

However, I'm not certain this will bring more work, as the node js project does some initialization procedures and has some cron tasks scheduled.但是,我不确定这会带来更多的工作,因为 node js 项目做了一些初始化过程并安排了一些 cron 任务。 If I create more instances will chron tasks be duplicated?如果我创建更多实例会重复 chron 任务吗?

Or which is the best way to manage redundancy on this kind of environment?或者在这种环境中管理冗余的最佳方法是什么?

To always have 2 instances running, you do this in app.yaml set要始终运行 2 个实例,请在app.yaml set 中执行此操作

automatic_scaling:
  min_instances: 2

https://cloud.google.com/appengine/docs/standard/python/config/appref#scaling_elements https://cloud.google.com/appengine/docs/standard/python/config/appref#scaling_elements

Chron tasks will not be duplicated. Chron 任务不会重复。

This is the way to have this type of redundancy, but it comes at the cost of having to always pay for 2 instances这是获得此类冗余的方法,但代价是必须始终为 2 个实例付费

But, what's going on when you actually get an "unexpected crash in a service call".但是,当您真正遇到“服务调用中的意外崩溃”时会发生什么。 That doesn't sound normal.这听起来不太正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM