Here is the god configuration I have done.
God.watch do |w|
pid_file = "#{Rails.root}/tmp/pids/delayed_job.pid"
w.pid_file = pid_file
pid = File.read(pid_file)
w.log = "#{Rails.root}/log/god.log"
w.name = "delayed_job"
w.dir = Rails.root
w.interval = 15.seconds
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
w.start = "RAILS_ENV=production ruby #{Rails.root}/bin/delayed_job start"
w.stop = "RAILS_ENV=production ruby #{Rails.root}/bin/delayed_job stop"
w.restart = "RAILS_ENV=production ruby #{Rails.root}/bin/delayed_job restart"
w.env = { 'RAILS_ENV' => "production" }
w.behavior(:clean_pid_file)
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 60.seconds
c.running = false
end
end
# When to restart a running deamon?
w.restart_if do |restart|
restart.condition(:memory_usage) do |c|
c.above = 200.megabytes
c.times = [2,5]
end
restart.condition(:cpu_usage) do |c|
c.above = 90.percent
c.times = 2
end
end
end
It is entering into the :cpu_usage condition when the CPU load is high but does not do so when the memory load goes higher than 200 MB. Is there anything in the above script that is obviously wrong, but that I'm unable to spot? Or is there something more that I need to add?
Aucun commentaire:
Enregistrer un commentaire