Dudley F. wrote:
This has come up several times on the list recently. The problem seems
to be that the fcgi processes get paged out of memory after a while,
causing a delay when they get swapped back in. A workaround would be to
set up a cron job that uses wget to hit your site every few minutes.
This’ll keep the process in memory so it’ll be more responsive. I haven’t
had this problem myself, so I’m just parroting what I’ve heard elsewhere.
There was a thread “Idle Apache+FastCGI sleeping?” in which Ezra
Zygmuntowicz gave this advice:
I have seen this behavior before. It seems to me that when the
fcgi’s sit idle for too long they get paged out of memory. Then when
you hit the site after its been idle, the fcgi’s have to page back
into memory so hence the lag. The kludge that I use works great but
I’d be interested if there was another way. But this technique works
great in production for me.
Just add a cron job that uses curl or wget to grab a page thats not
cached(so it goes through rails) and send the output to /dev/null. If
you have the cron job do this once every 5 minutes your fcgi’s will
always be ‘awake’ . And one hit every 5 minutes is virtually no extra
load on the server. But by doing things this way, your site will
always be snappy no matter how long it has been since a user visited