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 failedrps
-
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=ee&b=ee
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 51.9 516
Processing:14274.6 2750
Waiting:9274.7 2749
Total: 14323.7 3254
Document Path: /test/args?a=ee&b=ee
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: 18 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 51.8 518
Processing:12274.5 2863
Waiting:8274.5 2763
Total: 12323.7 3265
Document Path:
/test/params?a=ee&b=ee&c=ee&d=ee&e=ee&f=ee&g=ee&h=ee&i=ee&j=ee&k=ee&l=ee&m=ee&n=ee&o=ee&p=ee&q=ee&r=ee&s=ee&t=ee&u=ee&v=ee&w=ee&x=ee&y=ee&z=ee
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)