I didn't ever actually see a post with newer numbers, so here goes......

I tested the same 50 clients/5000 requests as stas' test in the guide. 
one pass with 2 uri params; another with 26.  naturally I ran it all on 
a server big (and quiescent) enough to handle the 50 concurrent 
requests.  I left out CGI since we already know it is slow.

/test/params and /test/args are mod_perl handlers (I don't use 
Apache::Registry for anything) ParamsTest and ArgsTest respectively. 
the code for both handlers and the relevant pieces of ab output are 
pasted in below.

   -------------------------------------------------------------
   name           query_length  | avtime completed failed    rps
   -------------------------------------------------------------
   apache_args              25  |  33.77      5000      0   1481
   apache_request           25  |  33.17      5000      0   1507
   apache_args             337  |  43.51      5000      0   1141
   apache_request          337  |  45.31      5000      0   1103
   --------------------------------------------------------------
   Non-varying sub-test parameters:
   --------------------------------------------------------------
   concurrency : 50
   connections : 5000

so $apr->param is marginally faster than $r->args for the shorter query, 
marginally slower for the longer one.  I think this may be because we 
can return the full hash $r->args whereas we need to map over 
$apr->param to get a hash (so param gets called three times for the 
short query, 27 times for the larger one).  still, much closer numbers 
than the former test...

- mark

package ParamsTest;

use strict;

use Apache;
use Apache::Constants qw( OK );
use Apache::Request;

sub handler {
     my $r = Apache::Request->new( shift );
     $r->send_http_header( 'text/plain' );
     my %args = map { $_ => $r->param( $_ ) } $r->param();
     $r->print( join( "\n",
                      map { join( '',
                                  $_ , ' => ' , $args{$_}
                                ) }
                      keys %args
                    )
              );
     return OK;
}

1;

package ArgsTest;

use strict;

use Apache;
use Apache::Constants qw( OK );

sub handler {
     my $r = shift;
     $r->send_http_header( 'text/plain' );
     my %args = $r->args();
     $r->print( join( "\n",
                      map { join( '',
                                  $_ , ' => ' , $args{$_}
                                ) }
                      keys %args
                    )
              );
     return OK;
}

1;


Document Path:          /test/params?a=eeeeeeeeee&b=eeeeeeeeee
Document Length:        31 bytes

Concurrency Level:      50
Time taken for tests:   3.317 seconds
Complete requests:      5000
Failed requests:        0
Broken pipe errors:     0
Total transferred:      883520 bytes
HTML transferred:       155620 bytes
Requests per second:    1507.39 [#/sec] (mean)
Time per request:       33.17 [ms] (mean)
Time per request:       0.66 [ms] (mean, across all concurrent requests)
Transfer rate:          266.36 [Kbytes/sec] received

Connnection Times (ms)
               min  mean[+/-sd] median   max
Connect:        0     5    1.9      5    16
Processing:    14    27    4.6     27    50
Waiting:        9    27    4.7     27    49
Total:         14    32    3.7     32    54


Document Path:          /test/args?a=eeeeeeeeee&b=eeeeeeeeee
Document Length:        31 bytes

Concurrency Level:      50
Time taken for tests:   3.377 seconds
Complete requests:      5000
Failed requests:        0
Broken pipe errors:     0
Total transferred:      883168 bytes
HTML transferred:       155558 bytes
Requests per second:    1480.60 [#/sec] (mean)
Time per request:       33.77 [ms] (mean)
Time per request:       0.68 [ms] (mean, across all concurrent requests)
Transfer rate:          261.52 [Kbytes/sec] received

Connnection Times (ms)
               min  mean[+/-sd] median   max
Connect:        0     5    1.8      5    18
Processing:    12    27    4.5     28    63
Waiting:        8    27    4.5     27    63
Total:         12    32    3.7     32    65


Document Path: 
/test/params?a=eeeeeeeeee&b=eeeeeeeeee&c=eeeeeeeeee&d=eeeeeeeeee&e=eeeeeeeeee&f=eeeeeeeeee&g=eeeeeeeeee&h=eeeeeeeeee&i=eeeeeeeeee&j=eeeeeeeeee&k=eeeeeeeeee&l=eeeeeeeeee&m=eeeeeeeeee&n=eeeeeeeeee&o=eeeeeeeeee&p=eeeeeeeeee&q=eeeeeeeeee&r=eeeeeeeeee&s=eeeeeeeeee&t=eeeeeeeeee&u=eeeeeeeeee&v=eeeeeeeeee&w=eeeeeeeeee&x=eeeeeeeeee&y=eeeeeeeeee&z=eeeeeeeeee
Document Length:        415 bytes

Concurrency Level:      50
Time taken for tests:   4.531 seconds
Complete requests:      5000
Failed requests:        0
Broken pipe errors:     0
Total transferred:      2810640 bytes
HTML transferred:       2082885 bytes
Requests per second:    1103.51 [#/sec] (mean)
Time per request:       45.31 [ms] (mean)
Time per request:       0.91 [ms] (mean, across all concurrent requests)
Transfer rate:          620.31 [Kbytes/sec] received

Connnection Times (ms)
               min  mean[+/-sd] median   max
Connect:        0     7    2.9      6    22
Processing:    18    37   11.2     36   496
Waiting:       12    36   11.1     36   495
Total:         18    44   10.8     43   501


Document Path: 
/test/args?a=eeeeeeeeee&b=eeeeeeeeee&c=eeeeeeeeee&d=eeeeeeeeee&e=eeeeeeeeee&f=eeeeeeeeee&g=eeeeeeeeee&h=eeeeeeeeee&i=eeeeeeeeee&j=eeeeeeeeee&k=eeeeeeeeee&l=eeeeeeeeee&m=eeeeeeeeee&n=eeeeeeeeee&o=eeeeeeeeee&p=eeeeeeeeee&q=eeeeeeeeee&r=eeeeeeeeee&s=eeeeeeeeee&t=eeeeeeeeee&u=eeeeeeeeee&v=eeeeeeeeee&w=eeeeeeeeee&x=eeeeeeeeee&y=eeeeeeeeee&z=eeeeeeeeee
Document Length:        415 bytes

Concurrency Level:      50
Time taken for tests:   4.381 seconds
Complete requests:      5000
Failed requests:        0
Broken pipe errors:     0
Total transferred:      2808960 bytes
HTML transferred:       2081640 bytes
Requests per second:    1141.29 [#/sec] (mean)
Time per request:       43.81 [ms] (mean)
Time per request:       0.88 [ms] (mean, across all concurrent requests)
Transfer rate:          641.17 [Kbytes/sec] received

Connnection Times (ms)
               min  mean[+/-sd] median   max
Connect:        0     7    3.0      7    35
Processing:    13    36    6.5     35    86
Waiting:        8    35    6.5     35    86
Total:         13    42    5.6     42    90

Stas Bekman wrote:
> Joe Schaefer wrote:
>> Right- param() was rewritten as XS about 6-8 months ago; since then
>> I've benchmarked it a few times and found param() to be a bit faster than
>> args().  We'll be releasing a 1.0 version of libapreq as soon as Jim 
>> approves of the current CVS version.  Here's what I got using it on 
>> your benchmark (some differences: the tests were run against localhost 
>> running perl 5.00503 + mod_perl 1.26 + apache 1.3.22 and using Perl 
>> handlers instead of Apache::RegistryLoader scripts):
> 
> Great! Now we have an even broader benchmark. Please tell me when 1.0 is 
> released (in case I get carried away with other things and don't notice 
> the announce) and I'll make sure to update my benchmarking package, 
> re-run the benchmarks and correct the results in the guide.
> 
> Thanks Joe!

Reply via email to