mojombo / god

Ruby process monitor
http://godrb.com
MIT License
2.21k stars 532 forks source link

Multiple Processes/PIDs per Watch #7

Open warrickcustomhomes opened 14 years ago

warrickcustomhomes commented 14 years ago

Wanting to use God to watch delayed_job for a Rails app. I'd like to allow for multiple unique delayed_job workers using the -n switch available in delayed/command.rb. When this switch is used, multiple delayed_job worker processes are started, all using the same Rails environment to save memory. When these processes are started, PID files like delayed_job.0.pid, delayed_job.1.pid, etc are created in tmp/pids/.

If I specify "script/delayed_job -n 5 start" in my watch configuration for delayed_job, God seems to fail when watching the processes. I tried specifying "Dir['tmp/pids/delayed_job.*.pid'] as the pid_file in the watch, but I assume God is expecting a string here, not an array. I could just configure multiple god watches for multiple delayed_job processes similar to how people do it for Thin configurations, but that takes away the advantage of having multiple delayed_job workers being able to use the same Rails environment to save memory.

Any ideas? By the way, the God application is freaking awesome regardless. :)

eric commented 14 years ago

There is no current support for child process monitoring.

We've been batting around ideas to solve this problem, as it's relevant for both Unicorn and Passenger as well as many other cases.

warrickcustomhomes commented 14 years ago

Can you share some of the current ideas? Can it be something as simple as monitoring all processes with PIDs specified in delayed_job.*.pid files? Does Unicorn and Passenger save their pids with similar file names like delayed_job does?

eric commented 14 years ago

The current idea is that god would be able to automatically monitor all of the child processes (we can get that info from the OS).

It wouldn't include any mechanism to be "restarting" the child processes, just use the conditions to monitor if they were using too much CPU or RAM and have a mechanism to kill them.

warrickcustomhomes commented 14 years ago

Just checking in here. :) Has any progress been made on this? If not, how can I help? Hints on where to look for existing code would be helpful.

eric commented 14 years ago

I have not had a chance to work on it.

My current thinking is that a custom kind of Watch would be created for each of the children.

harsh-shoto commented 5 years ago

Is there any support for monitoring the child process of puma workers with god.