As the site has grown, we've started to feel the pains of shared hosting. Our current provider site5 has proven incapable of living up to the task. For folks interested in starting a ruby on rails application, you can look forward to the following:
1. No phone support, no sales support.
2. Overcrowded servers. Don't believe their advertising, their machines are powerful but they put 20+ people per machine and any given user can eat up all the RAM on their machines.
3. Extremely limited Ruby on Rails expertise. Today, buddystumbler.com's ridiculously slow rendering Captcha is due to a random Site5 reconfiguration of their ImageMagick installation which has yet to be resolved. The system administrators do not know why it is so slow.
4. Most technical questions are redirected to their forums where users are forced to fend for themselves.
5. No mongrel support. Site5 uses FastCGI. Moreover, the FastCGI configuration allows each user to scale between 1 and 5 dispatches. There is a process killer that randomly kills off processes when load is too high. This gives folks the "Rails Application Error" problem. They need to configure their box to have a fixed number of dispatches. This has been communicated to their support team - but since they aren't really Rails specialists, they don't know how to size their servers in this situation.
6. Site5's response to any performance issues is to kill people's processes then resolve the ticket. The technical support people basically treat you like a raving lunatic. When asked about upgrade options, they just pointed me to their sales page.
Over time, I've scoured the internet to work on ways to "hide" the "Rails Application Error" problem. The dispatch.fcgi below has worked best for me, much thanks goes to Chris Gaskett.
# # Custom log path, normal GC behavior.
# RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
#
require File.dirname(__FILE__) + "/../config/environment"
require 'fcgi_handler'
class RailsFCGIHandler
private
# improved version of frao_handler
# by Chris Gaskett chris.gaskett.com
# tries to keep one fcgi process alive
# still might need a kill -9 sometimes if processes hangs
def pfrao_handler(signal)
dispatcher_log :info, "asked to terminate immediately"
number_procs = `/bin/ps ux | /bin/grep -c fcgi$`.to_i
# note: to_i produces 0 if conversion to integer is not successful
case number_procs
when 0
dispatcher_log :info, "pfrao handler error, check number_procs query, paths. Exiting"
exit
when 1 .. 2
dispatcher_log :info, "pfrao handler restarting instead, only two process left"
restart_handler(signal)
else
dispatcher_log :info, "pfrao handler agreed to exit, more than two process is running"
exit
end
end
alias_method :exit_now_handler, :pfrao_handler
end
RailsFCGIHandler.process! nil, 50
I share the code above because, buddystumbler is moving! Over the next couple of week's we'll be moving our source code repository and the entire site to a more reliable host which should help our uptime tremendously (as well as improve site performance).
Thanks for putting up with this!