in reply to Re^7: Thread::Pool and Template Toolkit
in thread Thread::Pool and Template Toolkit
I agree, it shouldn't be that hard to create my own throttling and pool managing code, but since I am a thread newbie I haven't been able to come up with anything as quick and clean as using the module. I have noticed that without the module I can fire off up to about 10 threads at once without seeing the system run into performance type issues, but anything after that and the actions start taking longer than if there were no threads involved and the thread function (in this case telneting to a router using Net::Telnet::Cisco and getting stats) has a tendency to timeout. Example of what I am doing with Thead::Pool:
*In my case @values is a list of IP addresses usually between 25-30 total values.
*In my case @values is a list of IP addresses usually between 25-30 total values.
my $pool = Thread::Pool->new( {workers => 5, do => \&telnet2Cli} ); my $count = 0; foreach $value (@values) { $thr[$count] = $pool->job($threadUse, $value, "show ver +sion"); $count += 1; } my $index; my @versionOutput; for ($index=0; $index < $count; $index++) { $versionOutput[$index] = $pool->result( $thr[$index] ); + }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^9: Thread::Pool and Template Toolkit
by BrowserUk (Patriarch) on Aug 09, 2004 at 17:38 UTC | |
by perldragon80 (Sexton) on Aug 10, 2004 at 18:51 UTC | |
by BrowserUk (Patriarch) on Aug 10, 2004 at 19:38 UTC | |
by perldragon80 (Sexton) on Aug 11, 2004 at 01:18 UTC |
In Section
Seekers of Perl Wisdom