[英]How to balance load in a Apache + Mongrel application
I was wondering if someone can explain how can a rails application be balanced. 我想知道是否有人可以解释如何平衡Rails应用程序。
Two questions: 两个问题:
Does it even help having separate rails applications reading from the same database in the same dedicated server? 它是否还有助于使单独的Rails应用程序从同一专用服务器中的同一数据库读取?
I understand Apache can balance load installing some extra modules? 我了解Apache可以平衡负载以安装一些额外的模块吗? am i right?
我对吗? how can we accomplish this?
我们怎样才能做到这一点? (please provide explanation for dummies)
(请提供假人的说明)
I would have a look at using Passenger - it has largely superseded Mongrel and handles running multiple Rails instances. 我将看一下使用Passenger的情况-它在很大程度上取代了Mongrel并处理了运行多个Rails实例。
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. Rails是单线程的,因此在使用Mongrel进行部署时,在安装了mod_proxy的Apache前面的集群中运行多个Mongrel实例是“正常的”。 This lets Apache dispatch multiple requests to free application instances.
这样,Apache可以将多个请求分派到空闲的应用程序实例。
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. 根据您的服务器资源,运行多个Mongrel实例会带来很多好处-实际上,这是处理并发请求的唯一方法。
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. 即使在小型内存主机(例如512mb)上,如果您的Rails应用使用100mb内存,您也可以轻松地运行多个实例而不会耗尽资源-然后,您可以像实例一样处理多个并发请求。
Sliecehost has some awesome articles like this one: http://articles.slicehost.com/2009/4/17/centos-apache-rails-and-mongrels Sliecehost上有一些很棒的文章,例如: http ://articles.slicehost.com/2009/4/17/centos-apache-rails-and-mongrels
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.