2009-07-06 12 views
13

Perlで並列処理に最適なモジュールは何ですか? Perlで並列処理を行ったことはありません。Perlでの並列処理に最適なモジュールは何ですか?

DBアクセスと郵送で使用される並列プロセス用の良いPerlモジュールとは何ですか?

私はモジュールParallel::ForkManagerを調べました。任意のアイデアが評価されます

+5

CPUバウンドコードまたはIOバウンドコードを並列化しますか? – jrockway

答えて

13

Parallel::ForkManagerは、PODによれば、フォークオフされるプロセスの数を制限することができます。あなたは子供を使って仕事をすることができます。私はダウンローダのためのモジュールを使用して覚えています。

12

まあ、それはすべて特定のケースに依存します。 - のために

は、いくつかのタスクに特化したモジュールもあります:あなたは正確に達成するために必要なものに応じて、次のいずれかとのより良いかもしれません例LWP::Parallel::UserAgentは、基本的には、可能な限り最良の答えを得るために達成したいことについて、さらに詳しく説明しなければなりません。

7

MCE(Many-core Engine for Perl)がCPANに掲載されました。

http://code.google.com/p/many-core-engine-perl/

https://metacpan.org/module/MCE

MCEは、パターンやワードカウント集計のためにgrepingに猫ほどの小さなものを(-nてみてください)並列に実世界のユースケース・シナリオを示すさまざまな例が付属しています。

barrier_sync.pl 
      A barrier sync demonstration. 

cat.pl Concatenation script, similar to the cat binary. 
egrep.pl Egrep script, similar to the egrep binary. 
wc.pl  Word count script, similar to the wc binary. 

findnull.pl 
      A parallel driven script to report lines containing 
      null fields. It is many times faster than the binary 
      egrep command. Try against a large file containing 
      very long lines. 

flow_model.pl 
      Demonstrates MCE::Flow, MCE::Queue, and MCE->gather. 

foreach.pl, forseq.pl, forchunk.pl 
      These take the same sqrt example from Parallel::Loops 
      and measures the overhead of the engine. The number 
      indicates the size of @input which can be submitted 
      and results displayed in 1 second. 

      Parallel::Loops:  600 Forking each @input is expensive 
      MCE foreach....: 34,000 Sends result after each @input 
      MCE forseq.....: 70,000 Loops through sequence of numbers 
      MCE forchunk...: 480,000 Chunking reduces overhead 

interval.pl 
      Demonstration of the interval option appearing in MCE 1.5. 

matmult/matmult_base.pl, matmult_mce.pl, strassen_mce.pl 
      Various matrix multiplication demonstrations benchmarking 
      PDL, PDL + MCE, as well as parallelizing Strassen 
      divide-and-conquer algorithm. Also included are 2 plain 
      Perl examples. 

scaling_pings.pl 
      Perform ping test and report back failing IPs to 
      standard output. 

seq_demo.pl 
      A demonstration of the new sequence option appearing 
      in MCE 1.3. Run with seq_demo.pl | sort 

tbray/wf_mce1.pl, wf_mce2.pl, wf_mce3.pl 
      An implementation of wide finder utilizing MCE. 
      As fast as MMAP IO when file resides in OS FS cache. 
      2x ~ 3x faster when reading directly from disk. 
関連する問題