If I read your code correctly, you're forking a new process for each row, then in that process you start another process (the `./alert_main.pl line) that presumably does something with that row.

That strikes me as very inefficient. You'll probably get much better efficiency if you set up each sub-process to handle a more significant chunk of data (for instance, process 20% of the total number of rows). Fork() and exec() are pretty fast on most UNIX systems, but not THAT fast. Also, inlining alert_main.pl will probably make the system a LOT more efficient.

Also, unless ./alert_main.pl actually does something with the database this is never going to improve the performance, if the bottleneck is in waiting for the rows to arrive.


In reply to Re: fork-ing : my lack of understanding by Joost
in thread fork-ing : my lack of understanding by ethrbunny

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.