代理选择:mod_proxy_balancer、nginx + 代理平衡器,haproxy?
我们正在专用加速器上运行一个 Rails 站点:http://hansard.millbanksystems.com。 我们目前使用 mod-proxy-balancer 设置 Apache,代理到运行应用程序的四个杂种。
有些请求相当慢,为了防止其他请求在它们后面排队的情况,我们正在考虑代理选项,将请求定向到空闲的杂种(如果有)。
选项似乎包括:
为 Apache 重新编译 mod_proxy_balancer,如 http://labs.reevoo.com/
使用 Solaris 的公平代理平衡器编译 nginx
使用编译 Open Solaris 的 haproxy(尽管这可能不会)与 SMF 配合良好)
这些选项是否合理? 我们是否错过了任何明显的事情? 我们将非常感谢您的建议。
We're running a Rails site at http://hansard.millbanksystems.com, on a dedicated Accelerator. We currently have Apache setup with mod-proxy-balancer, proxying to four mongrels running the application.
Some requests are rather slow and in order to prevent the situation where other requests get queued up behind them, we're considering options for proxying that will direct requests to an idle mongrel if there is one.
Options appear to include:
recompiling mod_proxy_balancer for Apache as described at http://labs.reevoo.com/
compiling nginx with the fair proxy balancer for Solaris
compiling haproxy for Open Solaris (although this may not work well with SMF)
Are these reasonable options? Have we missed anything obvious? We'd be very grateful for your advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
Apache 对于你的平衡来说有点奇怪。 它确实有能力,但就像使用坦克来购物一样。
Haproxy/Nginx 更适合这项工作。 您应该获得更高的吞吐量并同时使用更少的资源。
Apache is a bit of a strange beast to use for your balancing. It's certainly capable but it's like using a tank to do the shopping.
Haproxy/Nginx are more specifically tailored for the job. You should get higher throughput and use fewer resources at the same time.
HAProxy 提供了比 mod_proxy_balancer、nginx 和几乎任何其他软件更丰富的负载均衡功能。
特别是对于您的情况,日志输出是高度可定制的,因此应该更容易识别缓慢请求发生的时间、地点和原因。
此外,还有几种不同的负载分配算法可用,也具有良好的自动故障转移功能。
37Signals 在 这里 有一篇关于 Rails 和 HAProxy 的帖子(最初看到这里< /a>)。
HAProxy offers a much richer set of features for load-balancing than
mod_proxy_balancer
, nginx, and pretty much any other software out there.In particular for your situation, the log output is highly customisable so it should be much easier to identify when, where and why slow requests occur.
Also, there are a few different load distribution algorithms available, with nice automatic failover capabilities too.
37Signals have a post on Rails and HAProxy here (originally seen here).
如果您想避免 Apache,可以部署一个 Mongrel 集群,其中包含替代 Web 服务器(例如 nginx 或 lighttpd)以及某种负载均衡器(例如 Pound)或基于硬件的解决方案。
英镑 (http://www.apsis.ch/pound/) 对我来说效果很好!
if you want to avoid Apache, it is possible to deploy a Mongrel cluster with an alternative web server, such as nginx or lighttpd, and a load balancer of some variety such as Pound or a hardware-based solution.
Pounds (http://www.apsis.ch/pound/) worked well for me!
haproxy 和 SMF 的唯一问题是您无法使用它的软重启功能来实现“刷新”操作,除非您编写包装脚本。 我在此处写了更详细的内容,
但是,IME haproxy 已经在Solaris 上绝对防弹,我强烈推荐它。 我们每天通过 Solaris 10 上的单个 haproxy 实例发送从几百 GB 到几 TB 的任何数据,到目前为止(碰木头),在 2 年多的运行中,我们没有遇到任何问题。
The only issue with haproxy and SMF is that you can't use it's soft-restart feature to implement the 'refresh' action, unless you write a wrapper script. I wrote about that in a bit more detail here
However, IME haproxy has been absolutely bomb-proof on solaris, and I would recommend it highly. We ship anything from a few hundred GB to a couple of TB a day through a single haproxy instance on solaris 10 and so far (touch wood) in 2+ years of operation we've not had any problems with it.
Pound 是我过去成功使用过的 HTTP 负载均衡器。 它包括动态缩放功能,可以帮助解决您的特定问题:
Pound 很小,文档齐全,并且易于配置。
Pound is an HTTP load balancer that I've used successfully in the past. It includes a dynamic scaling feature that may help with your specific problem:
Pound is small, well documented, and easy to configure.
我已经成功使用mod_proxy_balancer + mongrel_cluster(小流量网站)。
I've used mod_proxy_balancer + mongrel_cluster successfully (small traffic website).