views:

80

answers:

1

I am developing a Ruby On Rails application and would like to deploy in a production environment. I have multiple identically configured Ubuntu web servers I can use but I don't know how to scale the RoR app and db data across multiple hosts.

I'd like to put both a web server and a db server on each host.

On the web server/ruby middleware side, I'd like sessions to be controlled by a master web server that does load balancing on the web server/ruby middleware layers. It should hand off new sessions to free hosts.

I need to have load balancing in place on the web server/ruby middleware side. Web/middleware sessions should be atomic (I'm not interested in replicating them across multiple hosts)

I'd like to have the transactional data that has not been saved to the DB logged to an intermediate redo-log -- to be re-run in case of failure-recovery.

In the DB layer:

I'd like to have the DB data on any one host to be replicated to 2 other hosts. (each DB set has 3 DB hosts)

I don't want to have the DB data replicated across all hosts because it takes too long -- latency.

I'd like to put an algorithm into place that will direct 'create'-type requests to the right DB. Load balancing comes to mind.

The DB master controller should know which 3-DB set to go to for 'update/read/delete' requests.

My test web server is webrick and the backend DB is Postgresql (though this really doesn't matter with RoR).

I believe I need to tie a sessionId to each transaction and also keep a redo-log in case I need to re-load that session after a failure.

What other design issues am I likely to run into? Also, what web server and DB server should I use to do the grunt work? What are good choices for the master DB and master web servers?

I understand this is a complicated problem that spans across multiple domains of knowledge. I'd like to know if what I'm asking is possible.

+1  A: 

At my last job we had pretty good luck with the following infrastructure:

1 load balancer -nginx

3 app servers -thin

2 mysql servers with redundant writes

2 backup boxes

currently we have 4 pretty large and mission critical apps running on that environment. We have two app servers to take care of the 5th app.

if you need more than that, then heroku will probably be a better bet in regards to ROI. Plainly, heroku is a better bet even for smaller scaling issues, you have a nightmare in sys admin in the above plan.

Jed Schneider