Wednesday, June 4, 2008

Setting up Fast CGI with GoDaddy (fcgi)

Using fastcgi on GoDaddy is paramount to getting any sort of performance with your rails application. If you're not using fast cgi, you will be waiting around 20-30 every time you hit your program with a request. Basically, nothing would work well. Changing your program's settings is as simple as modifying one line in your .htaccess file. First, go to application_name/public/.htaccess and open it in a text editor such at Notepad. Then, change the following line:
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
to
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

This will tell GoDaddy to send requests to Fast CGI, which is much faster. The first request your program gets may take up to 20 seconds, but subsequent requests come at expected speeds. Unfortunately, GoDaddy has the tendency to kill fcgi processes after about 5 minutes, and you might get the occasional error or the speed reduction at this time.

No comments: