2009-07-06 4 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. 
관련 문제