Forum: Ruby on Rails Tips to speed up Rails app (thesis)?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Joram (Guest)
on 2007-04-19 23:30
(Received via mailing list)
Hi List,

For my thesis I'm currently investing how a Rails can be sped up.

I've already done :
- caching
- transactions
- slow Ruby helpers manual written
- include when doing a find

I've also tried to use Mongrel, but compared to Webrick my results
were slower (see ), can
anyone explain this?

Another question: how can I test concurrency with ab, when I have
authentication filters?

Any other thing I should try?
James S. (Guest)
on 2007-04-19 23:55
(Received via mailing list)
On Apr 19, 2007, at 3:29 PM, Joram wrote:
> anyone explain this?
> Another question: how can I test concurrency with ab, when I have
> authentication filters?
> Any other thing I should try?

You might want to try different template engines/erb implementations.

eg. I found a significant improvement when I switched an app to erubis:


James S.
Brian H. (Guest)
on 2007-04-19 23:55
(Received via mailing list)
The platform you run on makes a huge difference.  Ruby is slow on
for example.  On a Windows system, Mongrel and WEBrick are equivalent.
major difference is that Mongrel continues to work for more than a few

You'll find that mongrel, webrick, fcgi, etc will perform around the
The important thing you need to think about is using more than one

For example, page caching is great, but if you're using Mongrel to serve
cached pages, you're not getting all of the benefits that page caching
provides. You want a static web server to serve your static content
js, stylesheets, html files), Reserve Mongrel for handling the actual
requests.  See Apache + mod_proxy_balance + Mongrel_cluster  or
Joram (Guest)
on 2007-04-20 00:10
(Received via mailing list)
Thanks for the replies!

I'm running both webrick and mongrel on ubuntu.
I also have a server thats running for almost 3 weeks now, on webrick
So Brian, If I understand you correctly, there should be no big
differences between mongrel/webrick,
but mongrel can be better used concurrently?

The apache combination is something I will look in to!
Brian H. (Guest)
on 2007-04-20 00:34
(Received via mailing list)
Yeah... but to put it better... webrick is not meant for production.
just not designed for it and will usually choke under load.

Rails is single-threaded... if you have only one mongrel running, you
only process one request at a time. That's why we load-balance. (It's
not as
bad as it sounds though, as most requests happen quickly.  2 is decent,
4 is
really good, I think I read that twitter uses something like 16 or

I don't know what tool you're using for your tests, but you might also
to consider httperf.

In fact, there's a great screen cast on benchmarking that you should
up. It only costs $9 and is quite awesome.
This topic is locked and can not be replied to.