Hello, time for my first question. ;)

I want to write a daemon in perl that receives new events from web scripts via POE::Component::Server::IKC and manages a queue of events that will be executed at a special point of time (selfwritten using POE too).

Currently, I implemented POE::Component::JobQueue to work on the events that are due for processing.

But since the events might take longer to process and should not block other parts of the program, I would like to rather use a pool of forked processes instead of cooperative multitasking.

Now the question is how can I realize the worker pool with the least work and trouble.

What I need is:

I searched CPAN for a while (disregarding modules in version 0.0001 / with bad documentation) and found the following modules:

POE::Component::Pool::Thread This one uses threading, which is, according to all i've read, not the way to go in perl on *nix, if it is possible. So I would rather not use it.

POE::Component::PreforkDispatch This one does exactly what I want. It lacks the "babysitting" and process watching stuff, but I think I could implement that using POE::Component::Supervisor, later on. I still wonder if it is stable enough.

I just wonder if XMLRPC isn't a bit too much for just sharing a hash of data...

POE::Component::Daemon I did not try this one out explicitely, but according to the description, it looks promising too. The "babysitting" is "probably badly implemented" according to the documentation... Using this module seems to be a bit messy, if I got the stuff with SocketFactory and status updates right in the documentation.. just doesn't look as high level and funny as the PreforkDispatch one...

All three modules are still in version 0.1* which makes me a bit careful. I would like to use proven / stable code. So if you have any experiences, I would be glad to hear of them.

Should I write it from scratch or can I safely use one of the modules above? Do you have other recommendations for me? I'm happy about all comments, thanks in advance.


In reply to POE, daemon, how to realize pre-forking worker pool for event processing? by Kallisti

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.