Greetings ModPerl Gurus,
Not seeing any significant speed up in my cgi scripts using mod-perl (3.5 RPS) over
straight
Apache (3.2 RPS), unlike in the past.
So figure I must have something configured incorrectly. Hopefully someone can tell
me what I have wrong.
Successfully built:
[Fri Jul 09 09:25:06 2004] [notice] Apache/2.0.50 (Unix) mod_perl/1.99_14 Perl/v5.8.3
configured -- resuming normal operations
All tests passed.
--------------------------------------------------------------------------------------------------------------------------------------
My httpd.conf:
Listen 8888
ServerRoot /users/webuser/apache_heavy
User webuser
Group webgroup
<IfModule prefork.c>
StartServers 2
MinSpareServers 2
MaxSpareServers 4
MaxClients 10
MaxRequestsPerChild 0
</IfModule>
# Assume no memory leaks at all
MaxRequestsPerChild 0
# it's always nice to know the server has started
ErrorLog logs/error_log
# Some benchmarks require logging, which is a good requirement. Uncomment
# this if you need logging.
#TransferLog logs/access_log
# If this was a real internet server you'd probably want to uncomment this:
<Directory "/">
order allow,deny
allow from all
</Directory>
Include /users/webuser/conf/page_aliases2.0.conf
Include /users/webuser/conf/heavy_script_aliases2.0.conf
LoadModule perl_module modules/mod_perl.so
PerlRequire /users/webuser/conf/startup2.0.pl
---------------------------------------------------------------------------------------------------------------------------------------
heavy_script_aliases2.0.conf contains:
ScriptAlias /tc-bin "/users/webuser/scripts/tc-bin/"
<Directory "/users/webuser/scripts/tc-bin/">
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI +FollowSymlinks
ExpiresActive On
ExpiresDefault "access plus 10 minutes"
AllowOverride None
Order allow,deny
Allow from all
</Directory>
----------------------------------------------------------------------------------------------------------------------------------------
starup2.0.pl looks like:
BEGIN{
use Apache2 ();
}
#*** mod_perl dso library will be built as mod_perl.so
#*** mod_perl static library will be built as mod_perl.a
#*** You'll need to add the following to httpd.conf:
#*** LoadModule perl_module modules/mod_perl.so
#
#*** Apache Perl modules will be installed relative to Apache2/
#*** Don't forget to:
#*** - configure 'PerlModule Apache2' in httpd.conf
#*** - or 'use Apache2 ();' in a startup script
#In order to gain a complete compatibilty with 1.0 while running
# under 2.0, you should load the compatibility module as early as possible:
use Apache::compat;
use ModPerl::Util (); #for CORE::GLOBAL::exit
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();
use Apache::Server ();
use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();
use APR::Table ();
use ModPerl::Registry ();
use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';
use Carp ();
# The following code comes from http://perl.apache.org/tunning/
# This code inserted to log actual IP addresses vice only the local host
sub My::SquidRemoteAddr ($) {
my $r = shift;
my @ip = split(/,\s*/, $r->header_in('X-Forwarded-For'));
if (my $ip = pop(@ip)) {
$r->connection->remote_ip($ip);
}
return OK;
}
#load CGI.pm and call its compile() method to precompile
#but not import its autoloaded methods.
#use CGI qw(-compile :standard);
use CGI '-no_xhtml';
CGI->compile(':all');
use LWP::Simple ();
use Time::Local;
# Load Homegrown packages
use lib qw (/users/webuser/scripts/Modules);
use ATCF;
#use Animate;
use Archive;
use Buttons;
use Buttons_Config;
use Clouds;
use GOES_Clouds_Config;
use Images;
use Images_Config;
use Info;
use My_Regex;
use Navigate;
use Pages;
use Pages_Config;
use Paths_Config;
use Sat;
use Sat_Config;
use Sat_Tools;
use Tc;
use Tc_Config;
use Tc_Display;
use Training_Config;
use Training_Hashes;
use Training_Hashes_Config;
1;
---------------------------------------------------------------------------------------------------
Running Apache Bench on a light "regular" server:
[EMAIL PROTECTED] bin]$ ./ab -n 32 -c 4
http://web2.nrlmry.navy.mil:7777/tc-bin/tc_home2.cgi
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking web2.nrlmry.navy.mil (be patient).....done
Server Software: Apache/2.0.50
Server Hostname: web2.nrlmry.navy.mil
Server Port: 7777
Document Path: /tc-bin/tc_home2.cgi
Document Length: 35348 bytes
Concurrency Level: 4
Time taken for tests: 9.898866 seconds
Complete requests: 32
Failed requests: 0
Write errors: 0
Total transferred: 1140128 bytes
HTML transferred: 1131136 bytes
Requests per second: 3.23 [#/sec] (mean)
Then running it on the mod-perl enabled "heavy" server:
[EMAIL PROTECTED] bin]$ ./ab -n 32 -c 4
http://web2.nrlmry.navy.mil:8888/tc-bin/tc_home2.cgi
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.8 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking web2.nrlmry.navy.mil (be patient).....done
Server Software: Apache/2.0.50
Server Hostname: web2.nrlmry.navy.mil
Server Port: 8888
Document Path: /tc-bin/tc_home2.cgi
Document Length: 35348 bytes
Concurrency Level: 4
Time taken for tests: 8.989529 seconds
Complete requests: 32
Failed requests: 0
Write errors: 0
Total transferred: 1149063 bytes
HTML transferred: 1138833 bytes
Requests per second: 3.56 [#/sec] (mean)
No appreciable improvement! In the past have seen an order of magnitude gain.
Thank you very much for any assistance you can provide.
Need to get this working before the first hurricane approaches the US.
John Kent
Webmaster
Naval Research Laboratory
Monterey, CA
http://www.nrlmry.navy.mil/tc-bin/tc_home2.cgi
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html