简体   繁体   English

使用Nginx + node.js的最佳实践

[英]Best practice with Nginx + node.js

I'm deploying a light game server using nginx + node.js on AWS Beanstalk, and this just came to me: is it better to deploy multi nodes behind nginx? 我正在使用AWS Beanstalk上的nginx + node.js部署一个轻型游戏服务器,这就是我的意思:在nginx后部署多个节点会更好吗?

Let's assume I have three routers (functions) in node server application right now: FuncA, FuncB and FuncC, they are all in one node which means listening on one port, considering node.js is single process which should be very low performance. 我们假设我现在在节点服务器应用程序中有三个路由器(函数):FuncA,FuncB和FuncC,它们都在一个节点中,这意味着在一个端口上侦听,考虑到node.js是单个进程,应该是非常低的性能。

So my question is should I deploy them as three node applications, each one listen on individual port, and let nginx to do the load balance work. 所以我的问题是我应该将它们部署为三个节点应用程序,每个应用程序监听单个端口,并让nginx执行负载平衡工作。 Am I right? 我对吗?

Thanks, Yi 谢谢,易

If you're deploying to Beanstalk, you already have an Nginx instance that sits out in front of each instance of your application. 如果您要部署到Beanstalk,那么您已经拥有一个位于应用程序每个实例前面的Nginx实例。 It's built into Beanstalk. 它内置于Beanstalk中。 And then, there is a load balancer in front of those. 然后,在那些前面有一个负载平衡器。 No need to add anything else. 无需添加任何其他内容。

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

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