如何平衡 Apache 中的负载杂种应用
我想知道是否有人可以解释如何平衡 Rails 应用程序。
两个问题:
它是否有助于让单独的 Rails 应用程序从同一专用服务器中的同一数据库读取数据?
我了解 Apache 可以平衡负载安装一些额外的模块吗?我说得对吗?我们怎样才能做到这一点? (请为傻瓜提供解释)
I was wondering if someone can explain how can a rails application be balanced.
Two questions:
Does it even help having separate rails applications reading from the same database in the same dedicated server?
I understand Apache can balance load installing some extra modules? am i right? how can we accomplish this? (please provide explanation for dummies)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会考虑使用 Passenger - 它在很大程度上取代了 Mongrel 并处理运行多个 Rails 实例。
Rails 是单线程的,因此在使用 Mongrel 进行部署时,在安装了 mod_proxy 的 Apache 前端的集群中运行多个 Mongrel 实例是“正常”的。这使得 Apache 可以将多个请求分派给可用的应用程序实例。
任何合理的数据库都是为高水平的并发请求而设计的,因此应该能够处理大量的应用程序实例。
根据您的服务器资源,运行多个 Mongrel 实例有很大的好处 - 它实际上是服务并发请求的唯一方法。
即使在小内存主机(例如 512mb)上,如果您的 Rails 应用程序使用 100mb 内存,您也可以轻松运行多个实例,而不会耗尽资源 - 然后您可以处理与实例一样多的并发请求。
Sliecehost 有一些很棒的文章,例如: http:// /articles.slicehost.com/2009/4/17/centos-apache-rails-and-mongrels
I would have a look at using Passenger - it has largely superseded Mongrel and handles running multiple Rails instances.
Rails is single threaded, so when deploying with Mongrel it is "normal" to run several Mongrel instances in a cluster fronted by Apache with mod_proxy installed. This lets Apache dispatch multiple requests to free application instances.
Any reasonable databases is designed for high levels of concurrent requests so should be able to handle a far number of application instances.
Depending on your server resources there is great benefit in running multiple Mongrel instances - it is actually the only way to serve concurrent requests.
Even on a small-memory host (say 512mb), if your Rails app uses 100mb of memory you would be easily able to run several instances without running out of resources - you could then serve as many concurrent requests as you have instances.
Sliecehost has some awesome articles like this one: http://articles.slicehost.com/2009/4/17/centos-apache-rails-and-mongrels