Deploying RoR - Advice seeked!

Hi everyone!

I am developping a Ruby on Rails website with a heavy calculation component at the backend. The calculation module can take up to 30sec to produce a result and therefore the queries can be extremely slow to be answered.

I now want to deploy my website and I am having a hard time finding a good setup for it. I've tried the following two options and I'll explain the problems I've had using them. I'm looking for suggestions for either solving these problems or for a deployement environment that would suit my needs.

Setup 1. Apache2 Problem: It seems that all the StdOut and StdErr are directly send to apache, causing it to produce erroneous requests. Also all my logs are therefore empty and it is not that great to find out about the general status of the application or the errors that occur.

Setup 2: Apache2 + Mongrel cluster Problem: Mongrel is not multithreaded and as I've stated earlier my requests can take up to 30sec. So if I want to guarantee a fast service for my users I'd need a ridiculous number of mongrels running.

I'll be glad to give more precisions if needed and would appreciate any suggestions or advice!

Thanks alot, Laurent

Hi everyone!

I am developping a Ruby on Rails website with a heavy calculation component at the backend. The calculation module can take up to 30sec to produce a result and therefore the queries can be extremely slow to be answered.

[...]

I'll be glad to give more precisions if needed and would appreciate any suggestions or advice!

Run that task in the background, using for instance BackgroundDRb <http://backgroundrb.rubyforge.org/&gt;\.

Isak

Thanks a lot for this. I will definitely look into it since it seems to be great solution for our problem. About it, I see it's version 0.2; has anyone experience with it and can tell me a bit more about its stability/reliability?

Laurent,

I've used it to handle some slow jobs before and it has been great. One recomendation I can give you is to try out Litespeed instead of Apache or Mongrel. The performance is great and the admin interface makes your life easier. Give it a try before trying backgroundDrb and see how it goes.

Sincerely,

Adrian Marid

Thanks Adrian!

A friend of mine actually pointed out Litespeed as a possible option too and I am going to give it a try. Maybe even use it in conjunction with backgroundDrb.

I will try this during this week and post the results I experience.

Laurent

Laurent,

Why don't you extend your Ruby with a little C code. This can be a great way to get a performance gain. The picaxe book has a great chapter called Extending Ruby that talks all about it. It is Chapter 21 and starts on page 275. This will place your computation in compiled C, and therefore will run much faster. Let me know if this works for you.

Amos

Hi Amos,

Good suggestion. The problem with this computation phase is that an important part (~70%) of the time is spent downloading data from foreign sources and therefore cannot really benefit from your proposition. I'll have to see how much I can benefit from a rewrite of the code in C.

I've had to postpone this deployement problem until now and I will post the results I obtain with the different solution suggested soon.

Thanks to all of you! Laurent

Thanks Frederick!

I'm exploring the backgroundrb at the moment and will post soon (I really will when I find a good solution :o)) the results I get.

Thanks for your pointer to the rubyinline project. It indeed seems like it can be very useful. I've decided to profile my application and see where the time is spent before rewritting anything in another language. But if it turns out I have to rewrite some parts then I'll definitely consider this lib.

Laurent