I recommend you avoid threading in Perl - it's really not a very good implementation. However, that doesn't mean you have to avoid multi-processing! Check out Parallel::ForkManager, a module that makes forking off sub-processes and collecting results reasonably pain-free. Just make sure you make new DBI connections in the child processes since multiple processes can't share a connection. Also, you'll have to set InactiveDestroy on any parent handles in the child so they don't get closed when the child exits.

As for #2, the answer is complicated. InnoDB supports real transactions with configurable semantics (read-committed is my favorite). It does support row-level locking, but that doesn't tell you ask much as you might think. I recommend some extended quality time with the manual.

#3 - yes. Your 8-way boxes need parallell code to perform up to their potential. From your description it sounds like just separating downloading, parsing and DB inserts into three processes would be a big improvement. Beyond that you might consider processing multiple streams of download/parse/insert in parallel.

-sam


In reply to Re: Threading - getting better use of my MP box by samtregar
in thread Threading - getting better use of my MP box 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.