views:

31

answers:

1

I was wondering if someone can explain how can a rails application be balanced.

Two questions:

  1. Does it even help having separate rails applications reading from the same database in the same dedicated server?

  2. I understand Apache can balance load installing some extra modules? am i right? how can we accomplish this? (please provide explanation for dummies)

+1  A: 

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

Toby Hede
Wow Toby Thanks!! You really helped me out!
Will