Rails tip - run FCGI if you can't do Mongrel


A small tip, but one I just encountered. If your web hosting provider can't allow you to set up a nice proxied Mongrel cluster, your best bet is to use the FastCGI (aka "FCGI") interface to Apache as the plain-Jane CGI interface is just slow as a dog. I ran into this little issue when using RedMine for my project management, and let me tell you it was slow. Well, it finally dawned on me to take a look see if it was using CGI or FCGI - low and behold by default it is set to use CGi, no wonder it was so slow! All it took to give it a 3x speed boost, i.e. make it run like a regular app, was to edit the public/.htaccess file and change the line that said

RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

to say

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

et voila, RedMine instantly turns into a much more usable application.