简体   繁体   English

我应该在同一台机器上使用1台或2台hapi.js服务器吗?

[英]Should I use 1 or 2 hapi.js servers on the same machine?

I have a tool I'm creating for which I have created two hapi.js api servers. 我有一个正在创建的工具,为此我创建了两个hapi.js api服务器。 ServerA contains all the small functional endpoints - currently only accepts requests from ServerB, but may not always in the future (this is why they aren't just functions sitting on ServerB). ServerA包含所有较小的功能端点-当前仅接受来自ServerB的请求,但将来可能不总是这样(这就是为什么它们不仅仅位于ServerB上的功能)。 ServerB is in charge of decisioning and accepts requests from anywhere. ServerB负责决策并接受来自任何地方的请求。

Is there are significant lag in having these two as separate servers on the same host? 将这两个服务器作为同一主机上的独立服务器是否存在重大滞后? I like keeping them separate because it helps me keep the functionality separate but I also want to minimize execution time. 我喜欢将它们分开,因为这有助于使功能分开,但我也想尽量减少执行时间。 ServerB always hits ServerA multiple times. ServerB总是多次击中ServerA。

Should I merge the two servers or is there no harm in keeping them separate? 我应该合并两个服务器,还是将它们分开不会有什么害处?

This is a great scenario to look into using hapijs plugins and also hapijs connections where by you can assign plugins to use a specific connection. 这是使用hapijs插件以及hapijs连接的绝佳方案,您可以在其中分配插件以使用特定连接。

Hosting multiple servers on the same box won't give you much degradation of performance except for the hop outside of process. 除了进程外的跃点,在同一台机器上托管多台服务器不会给您带来很多性能下降。 You are going to have trouble with setting up multiple servers listening on the same port (80). 您将难以设置在同一端口(80)上侦听的多个服务器。

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

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