I just started using rails.
After surfing and reading a lot I need some feedback from you guys.
In production level what is the best configuration to use Rails with
maximum performance. Correct me if I am wrong please.
I used #3 quite a little bit before figuring out that it’s not optimal
from the following point of view.
Apache has worker threads that handle requests and serve content. When
some static file is requested (css, js, html, …) the thread is
created and has a small memory footprint (some 1-5 Mb, which is huge
compared to some lightweight servers, like nginx). When it’s PHP /
FastCGI, there has to be more memory allocated (up to 35-50 Mb in my
experience). As Apache reuses workers, over the time all workers hold
the maximum memory and, as you can realize, make the server choke
(constant swapping etc).
What I came up with was a cluster of mongrel workers per application
(usually 2 is enough if you don’t do anything lengthy during the
request handling, which is bad by definition, or unless you have an
application bombarded by requests rapidly). So mongrel + the_server is
a great combination. You let the server serve the static content, and
let mongrel, with almost fixed memory footprint, do the interactive
job.
I don’t name the_server as it’s possible to use several solutions in
this configuration and it’s completely up to you what to go along
with. I prefer nginx as a front end, which proxies all requests and
gives PHP to Apache, Rails to Mongrel, while serving static itself.
I just started using rails.
After surfing and reading a lot I need some feedback from you guys.
In production level what is the best configuration to use Rails with
maximum performance. Correct me if I am wrong please.
nginx + mongrel_cluster is a really good solution if you don’t need
apache
OR don’t want to / can’t install Apache 2.2.
Apache 2.2+mongrel_cluster is great if you need to use Apache, but nginx
is
lighter and easier to configure (it does less stuff).
Stay away from mod_ruby or fastcgi. mod_ruby will run slow. fastcgi is
just
difficult to scale and tends to be a bit flakey. (On a shared host, it
may
be your only option though).
No it does not. That’s covered (by be) in “Deploying Rails
Applications”.
We wanted to include it in that book too but I had already made the
committment to Ezra and the Prags for that chapter.
I am working on a new book for O’Reilly that will cover development and
deployment of Rails apps on a Windows network. It’s geared towards the
ASP /
.Net crowd.
There will be a new release of the beta in a week to 10 days that
will include Brian chapter as well as update the book to cap2 and add
the nginx/apache chapter.
BTW, looking at the Balancer-Manager,there are certain info displayed
for
each mongrel process such as
Worker URL : http://127.0.0.1:9001
Route : 1
Route Redir Factor Set :0
Status : OK
Elected : 237
To :150K
Apart from Worker URL and Status, what does the rest mean ?
Are there any docs or resources that can explain how to use the
balancer-manager effectively ?
It would be great to have the answer in your book…
Have already posted to Apache Forum with no response.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.