in reply to Stress testing a web server

You are forking a child that then does another fork (in the system call). Assuming that the limitation is process number/fork speed based you can halve number of processes by using LWP::Simple.

I have added in an optional time delay - the children will all sleep until say 20 seconds have elapsed (by which time you should have lots of kids) at which point they all hit the server simultaneously which ought to have the desired effect. You could add in a random element to space the hits out over X seconds just by adding rand(X) to the delay....

#!/usr/bin/perl -w use strict; use LWP::Simple; my $runs = 100; my $time = time(); my $delay = 20; my $x = 1; my $hammer = 0; # set this to peak your network out! while ($runs) { my $pid = fork; # Parent if ($pid) { $runs--; } elsif ($pid == 0) { sleep 1 while $hammer and time() < $time + $delay + rand($x); my $output = get('http://www.mysitegoeshere.org'); exit; } else { die "Fork failed $!\n"; } }

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print