Gossamer Forum
Home : General : Perl Programming :

problem with multithreaded web client

Quote Reply
problem with multithreaded web client
this is my first time playing with forked processes and this script starts having issues when I run more than 10 or 20 threads... if I run a high number of threads if one process has a problem then all of them die... i need to figure out either my problem or how to debug this kind of thing. also, is there a better way to be doing this? I am trying to make a load testing application to stress test servers in a QA environment.

------------------

#!perl.exe

use LWP;
use HTML::Parse;
use HTML::Element;
use HTTP::Request;
use Thread qw(async);
use strict;

printf "\n-------\n";

my @children;
for (1..4)
{
$children[$i] = async {
getIt();
};
}

for (my $i=0;$i<4;$i++)
{
$children[$i]->join();
}

sub getIt()
{
my $ua = LWP::UserAgent->new();
$ua->agent("MyApp/0.1 ");
my $url = 'http://web.pdx.edu/~jonw';
my $req = HTTP::Request->new(GET => $url);
my $res = $ua->request($req);
my $code = $res->code;
my $content = $res->content;
if ($res->is_error())
{
printf "%s\n", $res->status_line;
}
else
{
my $content = $res->content();
}
printf "$content\n-------\n";
}

Last edited by:

mozkill: Apr 18, 2003, 3:36 PM
Subject Author Views Date
Thread problem with multithreaded web client mozkill 4713 Apr 18, 2003, 3:34 PM
Thread Re: [mozkill] problem with multithreaded web client
Paul 4615 Apr 18, 2003, 3:45 PM
Thread Re: [Paul] problem with multithreaded web client
mozkill 4633 Apr 19, 2003, 11:06 AM
Thread Re: [mozkill] problem with multithreaded web client
Paul 4590 Apr 19, 2003, 11:40 AM
Post Re: [Paul] problem with multithreaded web client
mozkill 4571 Apr 21, 2003, 11:28 AM