Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello

I am trying to do some benchmark testing on my server. I'd like to make the test script fork so i can simulate simultaneous HTTP GET requestss. How can I do this effectively?

This is what I have:

use LWP::Simple; use Time::HiRes qw(usleep gettimeofday tv_interval); open(URLS, "URL_LIST.txt") || die "Cannot Open URL_LIST.txt\n$!\n"; $startPounding = [gettimeofday]; while(<URLS>){ chomp; $t0 = [gettimeofday]; get($_); $t1 = [gettimeofday]; print LOG tv_interval($t0, $t1) . "\n"; } $endPounding = [gettimeofday]; close(URLS); print "Total Test Time: " . tv_interval($startPounding, $endPounding);

Replies are listed 'Best First'.
Re: Forking in WinNT/2000
by Fastolfe (Vicar) on Nov 14, 2000 at 07:40 UTC
    Check out LWP::Parallel, which provides LWP services in, well, parallel. It should do what you're trying to do.
Re: Forking in WinNT/2000
by gregorovius (Friar) on Nov 14, 2000 at 07:02 UTC
    I recently posted a CUFP that does just what you want, and it works on Windows. You can find it here.

RE: Forking in WinNT/2000
by AgentM (Curate) on Nov 14, 2000 at 05:28 UTC
    Look into LWP::Simple which will send your HTTP requests and Benchmark which will simply your benchmarking needs- it's a little trickier with fork() though so you'll need to look into waitpid to wait for and snatch the children appropriately.
    AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.