Unicorn multiple machines setup [closed]

烈酒焚心 提交于 2019-12-23 02:41:49

问题


I have a good experience with Unicorn configuration with conjunction of Nginx, it works really well after optimizations and tuning procedures. But now I have got a question what is the best way to spread the load across multiple machines with Unicorns.

The question is you have 3 machines (Nginx load balancer, 2 APP servers with Unicorns), how do you manage load balancing of Unicorns with serving static assets.

Do you now any drawbacks with connection to Unicorn over TCP (timeouts, connection lost), is there any other way to upstream socket connection over the network (maybe port forwarding over SSH)? Unicorn designed to be stateless, but how do you manage the edge cases?

I don't want to serve static from balancer node, so would it be ok to setup Nginx on each of APP server and setup dumb Nginx balancer in front of them?

P.S. My current configuration is well-tested and can be found on Github, but the setup with Nginx+Unicorn on the same machine that already became a bottleneck.

UPDATE: Development is rigidly depends on the specific server configuration. Bottlenecks are going to happen not just because of developer's decisions, but also with the environment where he run it. Stackoverlow is full with highly marked Q&A related to the hard-to-know details about specific configuration. Alex who answered below works with Github I'm really appreciate to have a reply by such qualified person!


回答1:


Don't access the Unicorns over TCP/network.

Your setup seems just fine, you can simply add a load-balancer in front of the APP servers, but I would suggest Keepalived (LVS ftw) as load-balancer instead of Nginx.

You can have them balance connections to the APP servers running Nginx+Unicorns over sockets.



来源:https://stackoverflow.com/questions/14082243/unicorn-multiple-machines-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!