i've changed some stuff and added fastcgi to the mix. i've given numbers through the proxy as well as without it for all the mod_perl examples

I've modified the scripts so that they producing the same amount of output for each example (except cgi, which adds a content-length header, so the total data transfered is larger)

here's the cgi, used under cgi, perlrun and registry:

#!/usr/bin/perl

use strict;

print qq[Content-Type: text/html\r\n\r\n];

my $blurb = qq[1234567890\n] x 100;

print <<EOF;
<html><body>
<h1>Hello Worlds</h1>
<pre>
$blurb
</pre>
</body></html>
EOF

here's the fastcgi version:

#!/usr/bin/perl

use strict;
use FCGI;

while (FCGI::accept >= 0) {

    print qq[Content-Type: text/html\r\n\r\n];

    my $blurb = qq[1234567890\n] x 100;

    print <<EOF;
<html><body>
<h1>Hello Worlds</h1>
<pre>
$blurb
</pre>
</body></html>
EOF

}

and here's the handler, used for perlscript and modperl:

package Kabob::HelloWorld;

use strict;

use Apache2::RequestRec ();
use Apache2::Const -compile =>qw(:common);

sub handler {
    my $r = shift;

    $r->content_type('text/html');

    my $blurb = qq[1234567890\n] x 100;

    $r->print(<<EOF);
<html><body>
<h1>Hello Worlds</h1>
<pre>
$blurb
</pre>
</body></html>
EOF

    return Apache2::Const::OK;
}

1;


This is the conf entry for fast-cgi

    Alias /fcgi/ /www/p/
    <Location /fcgi/>
        <IfDefine FrontEnd>
            SetHandler fastcgi-script
            Options +ExecCGI
        </IfDefine>
    </Location>

the conf entries for the other examples remained the same as they were in the original email. Obviously i didn't get to the different methods of CGI that dodger suggested. maybe over the weekend.

results ordered by transfer rate:

cgi - no proxy
Total transferred:      13080000 bytes
HTML transferred:       11640000 bytes
Requests per second:    95.58 [#/sec] (mean)
Time per request:       10.462 [ms] (mean)
Transfer rate:          122.09 [Kbytes/sec] received

perlrun - through proxy
Total transferred:      12860000 bytes
HTML transferred:       11640000 bytes
Requests per second:    463.07 [#/sec] (mean)
Time per request:       2.160 [ms] (mean)
Transfer rate:          581.52 [Kbytes/sec] received

registry - through proxy
Total transferred:      12860000 bytes
HTML transferred:       11640000 bytes
Requests per second:    641.11 [#/sec] (mean)
Time per request:       1.560 [ms] (mean)
Transfer rate:          805.10 [Kbytes/sec] received

perlrun - no proxy
Total transferred:      12860000 bytes
HTML transferred:       11640000 bytes
Requests per second:    658.17 [#/sec] (mean)
Time per request:       1.519 [ms] (mean)
Transfer rate:          826.53 [Kbytes/sec] received

perlscript - through proxy
Total transferred:      12860000 bytes
HTML transferred:       11640000 bytes
Requests per second:    788.59 [#/sec] (mean)
Time per request:       1.268 [ms] (mean)
Transfer rate:          990.31 [Kbytes/sec] received

modperl - through proxy
Total transferred:      12860000 bytes
HTML transferred:       11640000 bytes
Requests per second:    1063.74 [#/sec] (mean)
Time per request:       0.940 [ms] (mean)
Transfer rate:          1335.84 [Kbytes/sec] received

registry - no proxy
Total transferred:      12860000 bytes
HTML transferred:       11640000 bytes
Requests per second:    1160.28 [#/sec] (mean)
Time per request:       0.862 [ms] (mean)
Transfer rate:          1457.08 [Kbytes/sec] received

fastcgi - no proxy
Total transferred:      12860000 bytes
HTML transferred:       11640000 bytes
Requests per second:    1201.28 [#/sec] (mean)
Time per request:       0.832 [ms] (mean)
Transfer rate:          1508.57 [Kbytes/sec] received

perlscript - no proxy
Total transferred:      12860000 bytes
HTML transferred:       11640000 bytes
Requests per second:    1430.31 [#/sec] (mean)
Time per request:       0.699 [ms] (mean)
Transfer rate:          1796.18 [Kbytes/sec] received

modperl - no proxy
Total transferred:      12860000 bytes
HTML transferred:       11640000 bytes
Requests per second:    2430.80 [#/sec] (mean)
Time per request:       0.411 [ms] (mean)
Transfer rate:          3052.59 [Kbytes/sec] received

With the proxy taken out of the mix, the jump from perlscript to modperl is even more pronounced.

If anyone's got any ideas about why the proxy is having as significant an impact as it is, i'd love to tweak it. Also worth noting is that the front end is running worker, the backend is running prefork.

adam

Reply via email to