File: lwp-simple.pod

package info (click to toggle)
apache-perl 1.3.9-14.1-1.21.20000309-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,524 kB
  • ctags: 1,743
  • sloc: ansic: 9,017; perl: 7,822; sh: 864; makefile: 695
file content (46 lines) | stat: -rw-r--r-- 1,057 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
=head1 NAME

lwp-simple - using LWP::Simple and Benchmark.pm to benchmark mod_perl

=head1 DESCRIPTION

Here's what I generally use to benchmark, a Benchmark.pm/LWP::Simple 
combo.  With the script below, you should be able to
'make start_httpd' in the mod_perl-x.xx/ build directory
you might need to change the #! line in t/net/perl/cgi.pl
the configuration is already set up for /perl/ and /cgi-bin/

cgi.pl is very small, just load CGI.pm and prints a little bit, here's
the difference I see (on hpux-10.10):

Benchmark: timing 50 iterations of cgi, perl...
       cgi: 18 secs ( 0.96 usr  0.10 sys =  1.06 cpu)
      perl:  3 secs ( 0.76 usr  0.07 sys =  0.83 cpu)

=head1 THE SCRIPT

=cut 

 #!/opt/perl/bin/perl

 use Benchmark;
 use LWP::Simple;

 $base = "http://localhost:8529";
 $script = "cgi.pl?PARAM=2";

 for (qw(cgi-bin perl)) {
     $$_ = join "/", $base, $_, $script;
 }

 timethese(50, {
     "cgi" => "(\$s = get('${'cgi-bin'}')) or die \$s",
     "perl" => "(\$s = get('$perl')) or die \$s",
 });

=pod

=head1 AUTHOR

Doug MacEachern