

Ruby or compiled? - rcopfer

I'm trying to decide to take a 6 year old, very extensive application written in PHP, C sharp (mostly) and Perl and migrate the whole damn thing to Ruby on rails. This is an application that has an extensive MS Sql backend and searches TB's of text very quickly. No one in our industry supplies an open source solution so we would be first in a 6B + industry, of which, I have a miniscule percentage. My concern is that the compiled code runs very quickly and our customers require very fast searches across hundreds of thousands if not millions of records and I'm concerned the interpretive nature of Ruby will not perform as well. Testing that postulate will take a lot of effort and I'm worried of that cost if it is not as effective. I realize there is much more knowlegde of our app required to make a definitive decision but I'm leery of revelaing too much of our market on a public bulletin board. Any insights from a 60k foot view?
======
antics
The tighter the loop of whatever you're doing, and the more consistently it is
run over time, the slower your application will be, just generally speaking.
This is because the miniscule differences between individual operations add up
asymptotically to make a difference. If it's a matter of, say, performing a
square root exactly once, you will not notice a difference. If, on the other
hand, you are running a search algorithm over a _lot_ of text, you may
(probably will?) see significant slowdown.

Good news is, you can make (e.g.) a C-hook, that lets you write you app in
Ruby, and your "search" code in C (or something like that). I don't know what
you're doing specifically, so that may be an answer. I will say that if you're
interfacing heavily with the database in this search, it is very likely that
Rails is not the answer -- Rails tries to handle DB work transparently to the
user, and going against that problem is not just hard, but also REALLY labor
intensive. I'm told this is why twitter dropped Rails.

As far as speed goes, Ruby is about as fast as PHP at this point, although
rails runs a bit slower.

Hope that helps! Feel free to ask follow-up questions.

------
rbanffy
I will bet most of the time your app is waiting for your searches to complete
and come out of the database. Whatever you are doing your searches in, it pays
to use the fastest possible language. The front-end is, comparably, the easy
problem. You can do it in any language/framework you please. Ruby (and,
probably, Rails) seems a fine choice.

Before deciding, please, profile your current application to measure how much
time it spends doing what.

------
lfborjas
Check out rubinius, the bytecode seems to perform considerably faster than
interpreted source: <http://rubini.us/>

------
jamesbritt
Try JRuby, or maybe Mirah (though Mirah is still rough and evolving).

------
GrandMasterBirt
Heres my input on these sort of questions:

To determine what language to use, ask yourself the following question:

a) How many devs will or you want to support your application.

b) Approximately (ballpark) how many users will be sending simultaneous
requests? If there are going to be 20 people logged in total, performance is
not an issue.

c) How much time you have.

d) How much hardware will you be using?

e) Do you realize that doing queries from a table of 10 or 1000000 records are
equivalent to the application if you return 2 rows to it? The work is in the
database and will remain unchanged.

Now, many places chose RoR/PHP (and some good frameworks) as a front-end,
while using a "fast" language like java or erlang for the back-end. Facebook
is one such example. They use erlang to handle comet requests and php to
render the front end, and I think java to do back-end messaging and so on. The
front-end code just queries it.

If its a simple data application (show page, get input, query/update db, show
page) then RoR is easy to make/maintain. If there are 10,000 users logged in
at once, I'd think about this further. If you are a sole maintainer, RoR is
nice since it makes writing and maintaining simple granted you know what you
are doing.

