http://qs321.pair.com?node_id=775905


in reply to Parent/Child,Boss/Worker->IPC suggestions

I had good luck using Parallel::ForkManager and keeping shared state in a SQL database. I considered many other designs because the idea of polling the db bothered me, but ultimately this one was simpler to code and more scalable than anything else I came up with.

However... Isn't gearman supposed to do this for you? Why don't you make the jobs that you want to pass off to the workers into gearman jobs?

  • Comment on Re: Parent/Child,Boss/Worker->IPC suggestions

Replies are listed 'Best First'.
Re^2: Parent/Child,Boss/Worker->IPC suggestions
by josh803316 (Beadle) on Jun 30, 2009 at 07:34 UTC
    Yes, my original design was to have gearman do this for me but the problem I've been facing is shared memory, communication between parent and child workers and blocking during a long running gearman worker process....
    I wasn't sure how to create a manager/worker setup, all on the gearman worker side. I guess I could have the manager be a gearman worker and a gearman client at the same time. (Thoughts??).

      Yeah, I advise you not to use shared memory. I'd keep state in a database, and use signals if you need to interrupt running processes to shut them down.
Re^2: Parent/Child,Boss/Worker->IPC suggestions
by metaperl (Curate) on Jun 30, 2009 at 14:05 UTC
    I second shared state in a SQL(ite)? database. I tried a ton of IPC::* modules and couldnt get any of them to work. I also tried <CODE>Cache</CODE to no avail.