announcement: AnyEvent::Fork{,::RPC,::Pool}

Lee Aylward laylward at gmail.com
Wed May 1 04:59:10 CEST 2013


On Apr 24, 2013, at 9:17 PM, Marc Lehmann <schmorp at schmorp.de> wrote:

> 
>> Additionally, a feature I think would be useful for AE::Fork::Pool is
>> something like "max_requests". It would kill a worker after it handled
>> a certain number of requests. Useful when using leaky libraries like
>> ImageMagick.
> 
> That should be trivial to implement for a change:
> 
>   my $count;
> 
>   sub worker::function {
>      $count++ > 1000
>         and AnyEvent::Fork::Pool::retire ();
> 
>      ...
>   }
> 

Thanks! Seems to work well so far. Though I must admit, I've run into some open file limits that I didn't when using AE::Worker. I suspect this is just me not catching an error somewhere and some files or connections being kept open.

One other idea I had was the ability to name the forked processes. Right now they appear as something like:

  AnyEvent::Fork of 14079
  AnyEvent::Fork::RPC::Sync::run of 14079

With a few of these running it can be a bit confusing. It would be helpful if there were an option to name the template process (hopefully using this term correctly), and the children could also include it.

Thanks,
-- 
Lee




More information about the anyevent mailing list