in reply to Threading - getting better use of my MP box

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

  • Comment on Re: Threading - getting better use of my MP box