barathbr has asked for the wisdom of the Perl Monks concerning the following question:
Hello Folks,
My objective is to stress test a load balanced web server. I wrote a simple script using lwp::simple. The script in its current form is fetching the page. However, since it is initiating the connections seqentially I am actually not stressing the gateway. Could somebody point me in the right direction on how to go about spawning multiple instances. Code snippets would be really really appreciated.
Thanks a lot The current version is pasted below:
My objective is to stress test a load balanced web server. I wrote a simple script using lwp::simple. The script in its current form is fetching the page. However, since it is initiating the connections seqentially I am actually not stressing the gateway. Could somebody point me in the right direction on how to go about spawning multiple instances. Code snippets would be really really appreciated.
Thanks a lot The current version is pasted below:
use LWP::Simple; use strict; my ($count, $max, $URL); unless (defined ($URL = shift)) { print "\n\nEnter the site address which you would like to access: +"; chomp($URL = <STDIN>); } $URL = "http://" . "$URL"; print "Site address is $URL \n"; unless (defined ($max = shift)) { print "Enter the number of times to hit the site: "; chomp($max = <STDIN>); } for ($count = 0; $count <= $max; $count++){ my $content; unless (defined ($content = get $URL)) { die "could not get $URL\n"; } if ($content =~ /Test1</font>/i) { print "."; } elsif ($content =~ /Test2</font>/i) { print "Fetched page from Server2 \n"; $count++; &result; } else { print "Page not retreived \n" } } sub result { print "page retrieved after $count tries \n"; exit; }
Edited by Chady -- replaced <pre> tags with <code> tags
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: parallel web get with lwp::simple
by davorg (Chancellor) on Jul 26, 2004 at 08:15 UTC | |
by barathbr (Scribe) on Jul 26, 2004 at 08:25 UTC | |
Re: parallel web get with lwp::simple
by ccn (Vicar) on Jul 26, 2004 at 08:15 UTC | |
by Aristotle (Chancellor) on Jul 26, 2004 at 12:55 UTC | |
Re: parallel web get with lwp::simple
by davido (Cardinal) on Jul 26, 2004 at 08:03 UTC | |
by biosysadmin (Deacon) on Jul 26, 2004 at 14:38 UTC | |
Re: parallel web get with lwp::simple
by knoebi (Friar) on Jul 26, 2004 at 09:00 UTC | |
Re: parallel web get with lwp::simple
by BrowserUk (Patriarch) on Jul 26, 2004 at 13:49 UTC | |
Re: parallel web get with lwp::simple
by mpeters (Chaplain) on Jul 26, 2004 at 15:53 UTC | |
Re: parallel web get with lwp::simple
by pg (Canon) on Jul 26, 2004 at 15:12 UTC | |
Re: parallel web get with lwp::simple
by water (Deacon) on Jul 26, 2004 at 22:54 UTC | |
Re: parallel web get with lwp::simple
by sri (Vicar) on Jul 27, 2004 at 11:53 UTC |
Back to
Seekers of Perl Wisdom