php-resque icon indicating copy to clipboard operation
php-resque copied to clipboard

Child batch

Open kballenegger opened this issue 13 years ago • 8 comments

Workers will now accept a PERCHILD env variable. This will process multiple jobs in each child to reduce the amount of forks and drastically improve performance. Not setting the variable, or having a value of 1, is equivalent to the previous behaviors.

Did not write unit tests, but did document in comments and did adhere to code style used.

Deployed this in production in our (chartboost.com) high-traffic (1k jobs per second) environment and is running smoothly so far. Will report back tomorrow if anything is new.

kballenegger avatar Jan 06 '12 06:01 kballenegger

Wouldn't this compromise the safety provided by forking all of the job processing into another thread? I'd be fairly nervous about losing the graceful handling of failed jobs. Am I misunderstanding this?

jbrower avatar Jan 14 '13 17:01 jbrower

That's what I'm seeing here, too. Hey, @kballenegger - how far are we from the mark on this one?

danhunsaker avatar Mar 13 '13 09:03 danhunsaker

You're not wrong, it trades safety for scalability. Forks are extremely expensive.

I don't remember the specifics of how I'd implemented this though; it has been over a year. There may be better ways of doing this though internal acks via IPC or ZMQ sockets.

kballenegger avatar Mar 14 '13 22:03 kballenegger

This PR, unfortunately, won't apply cleanly anymore :-(

Dynom avatar Aug 31 '13 12:08 Dynom

@Dynom - I am not that surprised… it is over 2 years old!

kballenegger avatar Aug 31 '13 12:08 kballenegger

I'd love to see this get pulled in to the new repo, resque/php-resque, if you wouldn't mind a rebase/rebuild? It would be good, IMO, to give users this option.

danhunsaker avatar Dec 11 '18 07:12 danhunsaker

Given I wrote this code almost 7 years ago now, and I haven't written a line of PHP since 2014, I'll opt out from working on this further. There didn't seem to be much willingness to merge this anyways in the previous 7 years.

kballenegger avatar Dec 11 '18 17:12 kballenegger

Fair enough. I'll create an issue on the new repo (where things are moving forward quite rapidly at the moment) to get this implemented by someone else. Thanks for the original code, and the reply to my inquiry!

danhunsaker avatar Dec 11 '18 17:12 danhunsaker