You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <sb...@stason.org> on 2000/04/14 19:33:53 UTC

[RFC] Benchmarking Apache::Registry and Perl Content Handler

Disclaimer: the numbers here are too low for mod_perl, because my machine
is to slooooow :( I'll rerun the same tests on a much faster machine
before releasing the new version of the Guide. 

=head1 Benchmarking Apache::Registry and Perl Content Handler

=head2 Empty scripts

First lets see the overhead that Apache::Regsitry adds. In order to do
that we will use an almost empty scripts, that only send a basic
header and one word as a content.

The I<registry.pl> script running under C<Apache::Registry>:

  registry.pl
  -----------
  use strict;
  print "Content-type: text/plain\r\n\r\n";
  print "Hello";

The Perl Content handler:

  Benchmark/Handler.pm
  --------------------
  package Benchmark::Handler;
  use Apache::Constants qw(:common);
  
  sub handler{
    $r = shift;
    $r->send_http_header('text/html');
    $r->print("Hello");
    return OK;
  }
  1;

with settings:

  PerlModule Benchmark::Handler
  <Location /benchmark_handler>
    SetHandler perl-script
    PerlHandler Benchmark::Handler
  </Location>

The benchmark:

  % ab -n 1000 -c 10 http://localhost/perl/benchmarks/registry.pl
  
  Requests per second:    21.27
  Time taken for tests:   43.924 seconds
  Connnection Times (ms)
                min   avg   max
  Connect:        0     3   218
  Processing:   223   435   679
  Total:        223   438   897

  % ab -n 1000 -c 10 http://localhost/benchmark_handler
  
  Requests per second:    49.03
  Time taken for tests:   20.394 seconds
  Connnection Times (ms)
                min   avg   max
  Connect:        0     1   201
  Processing:    59   201   605
  Total:         59   202   806

So we can see that the average added overhead is about:

  438 - 202 = 236 milli-seconds

per script.

=head2 Heavy Scripts

Of course this overhead is insignificant when the code itself is
significantly heavier and slower. Let's leave the above code examples
umodified but add some CPU intensive processing operation (it can be
also an IO operation or a database query.)

  my $x = 100;
  my $y = log ($x ** 100)  for (0..10000);

  % ab -n 1000 -c 10 http://localhost/perl/benchmarks/registry.pl

  Time taken for tests:   121.944 seconds
  Requests per second:    8.20
  
  Connnection Times (ms)
                min   avg   max
  Connect:        0    11   950
  Processing:   747  1204   888
  Total:        747  1215  1838

  %ab -n 1000 -c 10  http://localhost/benchmark_handler

  Time taken for tests:   41.166 seconds
  Requests per second:    24.29
  
  Connnection Times (ms)
                min   avg   max
  Connect:        0     3   150
  Processing:    73   407  1211
  Total:         73   410  1361

META: something is wrong here! It shouldn't be that slower. Should try
run it on a faster machine!




______________________________________________________________________
Stas Bekman             | JAm_pH    --    Just Another mod_perl Hacker
http://stason.org/      | mod_perl Guide  http://perl.apache.org/guide 
mailto:stas@stason.org  | http://perl.org    http://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
----------------------------------------------------------------------


Re: [RFC] Benchmarking Apache::Registry and Perl Content Handler

Posted by Stas Bekman <sb...@stason.org>.
On Fri, 14 Apr 2000, Buddy Lee Haystack wrote:

> Hello!
> 
> Can you please provide the technical specifications for the hardware that performed these tests.

Sure, but the point here is a comparison and not absolute values,
therefore I believe this doesn't change a thing. Am I wrong? 

Anyway, here are the relevant specs:

Both the client (ab) and server were running on the same, quite loaded
machine, where 25% of CPU were eaten by xmms :) 

SW:
Perl: version 5.005_03 built for i386-linux
Server: Apache/1.3.10-dev (Unix) mod_perl/1.21_01-dev

HW: Memory: DIMM 256M
CPU:
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 5
model           : 4
model name      : Pentium MMX
stepping        : 4
cpu MHz         : 200.460259
fdiv_bug        : no
hlt_bug         : no
sep_bug         : no
f00f_bug        : yes
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr mce cx8 mmx
bogomips        : 399.77

I think I've some HW problems as everything is too slow lately :(

______________________________________________________________________
Stas Bekman             | JAm_pH    --    Just Another mod_perl Hacker
http://stason.org/      | mod_perl Guide  http://perl.apache.org/guide 
mailto:stas@stason.org  | http://perl.org    http://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
----------------------------------------------------------------------


Re: [RFC] Benchmarking Apache::Registry and Perl Content Handler

Posted by Buddy Lee Haystack <ha...@surfree.com>.
Hello!

Can you please provide the technical specifications for the hardware that performed these tests.

Thanks!



Stas Bekman wrote:
> 
> Disclaimer: the numbers here are too low for mod_perl, because my machine
> is to slooooow :( I'll rerun the same tests on a much faster machine
> before releasing the new version of the Guide.
> 
> =head1 Benchmarking Apache::Registry and Perl Content Handler
> 
> =head2 Empty scripts
> 
> First lets see the overhead that Apache::Regsitry adds. In order to do
> that we will use an almost empty scripts, that only send a basic
> header and one word as a content.
> 
> The I<registry.pl> script running under C<Apache::Registry>:
> 
>   registry.pl
>   -----------
>   use strict;
>   print "Content-type: text/plain\r\n\r\n";
>   print "Hello";
> 
> The Perl Content handler:
> 
>   Benchmark/Handler.pm
>   --------------------
>   package Benchmark::Handler;
>   use Apache::Constants qw(:common);
> 
>   sub handler{
>     $r = shift;
>     $r->send_http_header('text/html');
>     $r->print("Hello");
>     return OK;
>   }
>   1;
> 
> with settings:
> 
>   PerlModule Benchmark::Handler
>   <Location /benchmark_handler>
>     SetHandler perl-script
>     PerlHandler Benchmark::Handler
>   </Location>
> 
> The benchmark:
> 
>   % ab -n 1000 -c 10 http://localhost/perl/benchmarks/registry.pl
> 
>   Requests per second:    21.27
>   Time taken for tests:   43.924 seconds
>   Connnection Times (ms)
>                 min   avg   max
>   Connect:        0     3   218
>   Processing:   223   435   679
>   Total:        223   438   897
> 
>   % ab -n 1000 -c 10 http://localhost/benchmark_handler
> 
>   Requests per second:    49.03
>   Time taken for tests:   20.394 seconds
>   Connnection Times (ms)
>                 min   avg   max
>   Connect:        0     1   201
>   Processing:    59   201   605
>   Total:         59   202   806
> 
> So we can see that the average added overhead is about:
> 
>   438 - 202 = 236 milli-seconds
> 
> per script.
> 
> =head2 Heavy Scripts
> 
> Of course this overhead is insignificant when the code itself is
> significantly heavier and slower. Let's leave the above code examples
> umodified but add some CPU intensive processing operation (it can be
> also an IO operation or a database query.)
> 
>   my $x = 100;
>   my $y = log ($x ** 100)  for (0..10000);
> 
>   % ab -n 1000 -c 10 http://localhost/perl/benchmarks/registry.pl
> 
>   Time taken for tests:   121.944 seconds
>   Requests per second:    8.20
> 
>   Connnection Times (ms)
>                 min   avg   max
>   Connect:        0    11   950
>   Processing:   747  1204   888
>   Total:        747  1215  1838
> 
>   %ab -n 1000 -c 10  http://localhost/benchmark_handler
> 
>   Time taken for tests:   41.166 seconds
>   Requests per second:    24.29
> 
>   Connnection Times (ms)
>                 min   avg   max
>   Connect:        0     3   150
>   Processing:    73   407  1211
>   Total:         73   410  1361
> 
> META: something is wrong here! It shouldn't be that slower. Should try
> run it on a faster machine!
> 
> ______________________________________________________________________
> Stas Bekman             | JAm_pH    --    Just Another mod_perl Hacker
> http://stason.org/      | mod_perl Guide  http://perl.apache.org/guide
> mailto:stas@stason.org  | http://perl.org    http://stason.org/TULARC/
> http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
> ----------------------------------------------------------------------