monitの使用を見てください。メモリまたは CPU の使用状況に基づいて、mongrel を動的に再起動できます。これは、私のクライアント用に作成した構成ファイルの行です。
check process mongrel-8000 with pidfile /var/www/apps/fooapp/current/tmp/pids/mongrel.8000.pid
start program = "/usr/local/bin/mongrel_rails cluster::start --only 8000"
stop program = "/usr/local/bin/mongrel_rails cluster::stop --only 8000"
if totalmem is greater than 150.0 MB for 5 cycles then restart # eating up memory?
if cpu is greater than 50% for 8 cycles then alert # send an email to admin
if cpu is greater than 80% for 5 cycles then restart # hung process?
if loadavg(5min) greater than 10 for 3 cycles then restart # bad, bad, bad
if 3 restarts within 5 cycles then timeout # something is wrong, call the sys-admin
if failed host 192.168.106.53 port 8000 protocol http request /monit_stub
with timeout 10 seconds
then restart
group mongrel
次に、すべての mongrel クラスター インスタンスに対してこの構成を繰り返します。monit_stub 行は、monit がダウンロードしようとする単なる空のファイルです。できない場合は、インスタンスの再起動も試みます。
注: リソースの監視は、Darwin カーネルを使用する OS X では機能しないようです。