Deploying in Production Level (Ideas please)

Dear All,

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.

  1. Ruby on Rails, with lighttpd/mongrel, a database
  2. Ruby on Rails, mod_ruby with Apache2, a database
  3. Ruby on Rails, FastCGI with Apache2, a database

I know there want be any wrong answers.

regards,

J.

Hey there,

  1. Ruby on Rails, with lighttpd/mongrel, a database
  2. Ruby on Rails, mod_ruby with Apache2, a database
  3. Ruby on Rails, FastCGI with Apache2, a database

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.

That’s pretty much all to it.

  • A

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.

  1. Ruby on Rails, with lighttpd/mongrel, a database
  2. Ruby on Rails, mod_ruby with Apache2, a database
  3. Ruby on Rails, FastCGI with Apache2, a database
  1. Nginx and mongrel

Seems to also be a pretty popular choice.

Hi ace

Using Apache 2.2x (with mod_proxy_balancer) + a pack of mongrels seems
to be the recommended way…

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).

Grab the beta of “Deploying Rails Applications”.
Pragmatic Bookshelf: By Developers, For Developers Most of your questions should
be
answered there.

Hi Brian

Does your book “Rails in Windows” contain a chapter on deployment in
Windows ?

Thanks a lot…

Please let me know others ideas as well!

regards,

J.

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.

Hi Brian

I bought the beta PDF on 8th Oct.
Just regenerated the PDF five minutes ago and was disappointed not to
find the chapter written by you :frowning:

I’ve been assured it’s coming… just don’t know when.

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.

Cheers-
-Ezra

Hi Ezra

Great !

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.