Rails and Perl - Performance

It's completely unrealistic to expect that rails will be as mature as something like mod perl + template toolkit/Mason when it comes to performance. Any platform that gets widespread use improves over time, it's pretty much a given. Also, you can't compare mod perl directly to rails, they don't fulfill the same purpose. Mod perl is probably more comparable to mongrel in the function it serves, with Template Toolkit/Mason being the template engine, and various other perl modules taking care of session management and database connections. And you have to put all these pieces together yourself and know a lot more about how everything works then you do with rails.

I think another way to say what snacktime is talking about is to simply point out that Rails is a FULL STACK system whereas mod_perl is just a way to run perl. The equality is probably more of:

1) mongrel by itself vs. apache+mod_perl 2) rails+mongrel vs. mod_perl+mason+(whatever perl uses for AR, simply restful, etc.)

With the mongrel against mod_perl you'd create the simplest action for each and then test them out with a tool like httperf. This would be your baseline performance. For Mongrel it'd be something simple like:

class TestHandler < Mongrel::HttpHandler   def process(req, resp)     resp.start {|h,b| b.write("test") }         end end

Fill that out with a bit of Configurator (see examples/simpletest.rb) and you'll have your comparable test action. Then run both under the exact same conditions as in same server, same apache as a front end, no rewrite rules, etc. Try going against just mongrel see if that's faster (sometimes it actually is when compared with older apache mod_proxy).

The point is to be more exact in your comparisons so you avoid shoddy analysis. You may find that mod_perl rocks Mongrel to the core, but once you pile on that full stack the performance is horrible compared to Rails. Java is definitely in this camp where a simple bare bones Servlet can be way faster that Mongrel, but once you let a Software Architect Level 10 Grade A build your Acegi+Hibernate+Spring*+JTA+EJB monstrosity you get miserable performance.