0

What is the best way to test a site with Perl? How can I emulate a lot of connections to check how my script works on heavy load? Maybe there is a nice module on CPAN?

I am not interested in testing for dead links or 404 errors, only in work speed.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
tester3
  • 413
  • 1
  • 4
  • 12
  • Whatever you do, be careful of making too many requests; depending on how your site is hosted, you might get blacklisted as a denial-of-service attacker. – R. Barzell Mar 07 '14 at 00:00
  • Thanks, I am experimenting on my own server:) – tester3 Mar 07 '14 at 00:05
  • Is there a key script on your web site that you are concerned with? Perhaps you can stress-test it in isolation? – R. Barzell Mar 07 '14 at 00:07
  • I need a solution to test as you say 'key' pages and 'key' scripts. I am trying to understand what solutions work faster than others, and I need to do it with heavy load emulation. Yes, something like a stress-test – tester3 Mar 07 '14 at 00:14
  • Does this help? http://stackoverflow.com/questions/7492/performing-a-stress-test-on-web-application – R. Barzell Mar 07 '14 at 00:16
  • I am looking for something like that, but it would be better to be on Perl, or it can be a program for Linux which can be started from shell. It can be much simpler than JMeter, but if there will be no more sujjestions I think I will use JMeter:) – tester3 Mar 07 '14 at 00:27
  • Off the top of my head, I don't know of any Perl specific ones, but when I googled "stress test with perl" (without the quotes) a few promising links came up. Haven't tried them though... – R. Barzell Mar 07 '14 at 00:28
  • I've found a Prima::Stress module. But it has no normal documentation and even no normal description:) P.S. I've viewed some links for stress test with perl, but most of them are pretty old – tester3 Mar 07 '14 at 00:31
  • Local testing is still not production testing. This is key, I have often run tests locally that failed rather quickly under load and real sized database. So be sure have a deployment test plan too. – alexmac Mar 07 '14 at 03:09
  • I have written these before so I can help you but it seems pretty straight forward for example: `code` my @urls ; while($in=<>) { push @urls,$in ; $start=time(); for (i=0;i++; i< 99999999) { use LWP::Simple; my $content = get $url; die if (/error/ ~= $content) ; ## Decide if you want to look at anything else } $stop=time() ; ## Write a report – kkron Jul 11 '14 at 01:29

1 Answers1

0

I have written these before so I can help you but it seems pretty straight forward for example:

use LWP::Simple;
my @urls ;
while($in=<>) {
push @urls,$in ;
$start=time();
for (i=0;i++; i< 99999999) {
    use LWP::Simple;
    my $content = get $url;
    die if (/error/ ~= $content) ;  
##  Decide if you want to look at anything else
}


$stop=time() ;

## Write a report
kkron
  • 564
  • 3
  • 20