Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a developer trying to determine the best way to approach a rails app. I need to provide some options for deployment and am trying to minimize both development costs and long term hosting costs.

Consider a site that allows multiple authors to collaborate on a single "work", whether that be a novel, technical manual or even source code. "Users" are allowed to "check out" chapters, make modifications and merge changes back in. Users rate each others modifications with higher ratings allowing access to more and more content.Let's call it "social version control"

While it's possible to write a single rails app that can discriminate between "works", it may be easier from a coding perspective for each work to be hosted as it's own rails app. A "master" app would create/control each works server instance, allow browsing works in search of authors, and be a reporting hub for the site owner. For now, assume the simplest of schemes where each work uses a port specific url:

Master -
My Novel -
Some Manual -
Another work -

My question is: how many instances of rails will I be able to run on a single box before it is overwhelmed? Is there a way to determine how many instances can run on a commodity server? Is there another option that would allow scaling out additional works inexpensively (perhaps on EC2 or something similar). Because this isn't being designed as a money making venture, what's the least expensive way to deploy this (short of additional coding effort). I would like to have some sort of cost analysis before I offer alternatives but I don't know how to begin sizing something like this.

Any ideas or thoughts are appreciated.

share|improve this question

I have something very similar to what you have.

We have one application located in one directory. This application is set up for mutliple different clients. The only difference between each client is the database that they use. When we set it up, I decided that having a different port for each client was not very pretty therefore we took a different approach.

I know Apache is not very popular in the Rails scene but it is still a great piece of software. We used Apache's name-based virtualhost to tackle this problem along with Passenger3. In the new version, you can define a RailsEnv per virtualhost using the same application directory. The directive is called "PassengerAppGroupName".

You get a virtualhost looking something like this :

<VirtualHost _default_:80>
        DocumentRoot /var/xxxx/current/public/
        TimeOut 5000

        # Passenger directives
        PassengerHighPerformance on
        PassengerAppGroupName "preprod"
        RailsEnv preprod
        # Logging
        ErrorLog /var/log/apache2/preprod-error.log
        CustomLog /var/log/apache2/preprod-access.log combined


I think this example should clear things up. This solution allows you to separate your applications using the HTTP Host used to connect to it.

To sum up, if the "works" have the same code base all you can use this IMHO clean solution.

EDIT : In terms of performance, Apache/Passenger needs 512MB of RAM. I found that anything below that will lead to bad performance but YMMV. I don't believe it requires more RAM if you add more virtual host.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.