AV-Looks
Watching and Wondering

Optimizing Rails

Posted by Andrew Wed, 01 Feb 2006 00:47:00 GMT

For web hosts and developers, this is a big issue. If Rails is not managed well, it can become a huge drain on system resources.

Here are some excellent guidelines to review. We welcome comments!

NOTE: We suggest putting all of the following in a daily cronjob to keep your ruby runtime environment fresh. In this script you should stop apache and/or lighttpd first, then start them up after the cleanup operations are complete.

Get rid of stale dispatch processes

Whether you are running Apache or Lighttpd, dispatch.fcgi processes, once started, don’t clean themselves up. Therefore it is a good idea when restarting Apache and/or Lighttpd to check for any stale dispatch.fcgi processes, and get rid of them:

## Kill stale dispatch.fcgi processes 
killall -9 dispatch.fcgi

Purge old ruby sessions

## Purge Ruby sessions 1 day (24 hours) old and over
find /tmp/ -name 'ruby_sess*' -ctime -1|xargs rm -rf

Posted in ,  | Tags , ,  | 2 comments

Comments

  1. Avatar Nathaniel said 25 days later:

    -1 means everything newer than 24 hours.

    You want…

    find /tmp/ -name ‘ruby_sess*’ -ctime +1|xargs rm -f

    Also, you will note that I left out the -r flag. For deleting files, it is definately overkill to do a -r (recursive) delete.

  2. Avatar Andrew vonderLuft said 25 days later:

    Thanks Nathaniel. Points well taken!

(leave url/email »)

   Comment Markup Help Preview comment