Why not use apache's ab?
But once I did write a simple script for testing our web
applications,hope it's a little help to you.
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
use Encode;
for (1..100) {
unless (fork) {
test_site_com() for 1..10;
exit 0;
}
}
sub test_site_com {
my $aid = join '',map { int(rand(9)) } 0..5;
my $uri = 'http://www.site.com/myspace/default.php?aid=' . $aid;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => $uri);
$req->header('Accept' => 'text/html');
my $res = $ua->request($req);
if ($res->is_success) {
print encode('gb2312',decode('utf8',$res->content)),"\n";
}else {
print "Error: " . $res->status_line,"\n";
}
}
2007/10/9, Coyle, Jim <[EMAIL PROTECTED]>:
> Hi,
>
> I am an beginner using Perl.
> I need to load test a new web site - does anyone have some very basic
> code that I could re-use?
> Ideally I'm looking for something that simulates multiple users hitting
> the web site at the same time.
>
> Yours gratefully ...
>
> - Jim
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/