Hi all
I'm asking for some insight, guidance, comments from the list.
I'm currently running a pilot app under win2000 + apache 2.0.42 + perl5.8 + mod_perl. Mostly, it's running great, much faster than the vanilla CGI version. I think the database connection is slowing it down though... I currently have CGI pages caching on the client side, which is helping some, but I'm also going to experiment with CGI::Cache.
The application uptime is 2 weeks, but that's including prayers.
Here are the specifics.
In the http.conf, I have:
LoadFile "C:/Perl/bin/perl58.dll"
LoadModule perl_module modules/mod_perl.so
PerlRequire "C:/Apache2/conf/startup.pl"
PerlInterpStart 5
PerlInterpMaxSpare 5
PerlInterpMax 20
PerlInterpMaxRequests 5
In an included snoopy.conf:
Alias /snoopy/ "C:/Apache2/application/snoopy2/"
<Location "/snoopy/">
ExpiresActive On
ExpiresDefault "now plus 2 days"
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Location>
In the startup.pl:
#!C:/Perl/bin/Perl.exe
use Apache2();
use ModPerl::Registry ();
use DBI;
use DBD::ODBC;
use HTML::Template;
1;
I'm running the app under ModPerl::Registry (evident enough). The bulk of it is in Snoopy.pm, which I implement via OO method calls. Currently, each of 5 cgi pages has a use Snoopy.pm at the top.
The beginning of Snoopy.pm, before the actual methods, looks like:
# Since each CGI page has use Snoopy.pm, I put these directives at the top of
# Snoopy module. I thought it might be more efficient to have them in one place,
# instead of repeating them in each of the 5 CGI pages.
use CGI::Lite;
use HTTP::Date;
use DBI;
use HTML::Template;
use HTML::Parser;
package Snoopy;
use strict;
#--------------------------------------------------------------------------
# Class Data
#--------------------------------------------------------------------------
###connect to ODBC->ORACLE
my $db = 'xxxx';
my $user = 'xxxx';
my $pass = 'xxxx';
my $DBH = DBI->connect("DBI:ODBC:$db", $user, $pass, { RaiseError => 1, PrintError => 1, AutoCommit => 1 }) or die( "Unable to connect to Database: $DBI::errstr\n" ) ;
$DBH->{LongReadLen} = 10000;
our $AUTOLOAD;
### Set the tracing level to 2 and prepare
#DBI->trace( 1, 'dbitrace2.log' );
#--------------------------------------------------------------------------
sub new
{
my ($class, @args) = @_;
my $obj = {};
# Bless the hash reference obj. Create an object.
bless $obj, $class;
$obj->{dbh} = \$DBH;
# Call _init
$obj->_init(@args);
# return Object.
return $obj;
}
methods ...
1;
Is there anything here that spells trouble? What kind of trouble is there for having use DBI and use HTML::Template in both startup.pl and Snoopy.pm (besides being redundant)? Since Snoopy.pm is the meat and pototoes, should it also be in startup.pl? Does declaring Class variables, such as the DBI handle, offer any benefits (or pain) of a shared connection?
Are there any obvious (or not so obvious) issues with these configurations or code that should be knocking me in the head?
Thanks,
Paul