I’m on Dreamhost for hosting and have been finding that (noting
Dreamhost
kill off ruby processes) the first page return takes 20-40seconds, after
which things go ok. I’ve put some logging in the “dispatch.fcgi” code
and
note the following:
HTTP log output for initial request: X seconds
“dispatch.fcgi” entry: 1 second after this
fastcgi process log entry: 24 seconds after last step
my RoR app log entry: 1 second after last step
Question - Is it normal for the fastcgi processes to take this long to
start
up? Any suggestions on how to improve startup time?
Note: I am aware of a work around mentioned on the Dreamhost wiki which
I
will try (see below), however I wanted to make sure I can’t optimize the
root cause start up time before going into work around mode.
HTTP log output for initial request: X seconds
will try (see below), however I wanted to make sure I can’t
33057>seems
alias_method :exit_now_handler, :frao_handler
Regards
Uh, yeah, often that can happen. It’s shared hosting.
If you want something faster and more dedicated to your app, you’ll
need to move to some sort of VPS hosting (virtual private server)
where you pay for a slice of memory and processor time in your hosting.
FCGI is better than CGI.
DH does not allow persistent processes on their shared hosting. Even
while installing your own gems in your directory, their system will
occasionally kill it if it takes too long.
Still this may be more of a Rails question, as it pertains mainly to
rails and not so much to Ruby CGI specifically.
That said, it’s also actually more appropriate for the DreamHost
forums or to contact DH support (they are very responsive if you ask
nice questions)
Any ideas on whether this approach would assist in keeping more than 1
fastcgi? I note that there are 2-3 processes fastcgi ruby processes
that
Dreamhost seems to kickoff when I hit the website (I’m not sure where
this
number is specified).
Any ideas on whether this approach would assist in keeping more than 1
fastcgi? I note that there are 2-3 processes fastcgi ruby processes
that
Dreamhost seems to kickoff when I hit the website (I’m not sure where
this
number is specified).
I’m not sure where I got this tip from, but try adding this to your
crontab :
(replace username with your dreamhost username). It periodically kills
dispatch processes, which are then recreated by the app. It seems to
keep the number of dispatch processes for my app to around 3. Without
it, I found a lot of stale processes were created. If I recall, this can
be caused by errors in your app (check production.log), so perhaps I
don’t need this anymore. But it doesn’t seem to hurt!
Hope this helps,
Chris
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.