--- Stas Bekman <[EMAIL PROTECTED]> wrote:
> Perrin Harkins wrote:
> > On Tue, 2003-06-10 at 01:45, Stas Bekman wrote:
> >
> >>mp2+winFU => winnt MPM => no forking, only threads
> => Apache::DBI is useless
> >>there. not only useless, but also wasteful, since
> it's going to do work that
> >>has no added value.
> >
> >
> > But how is this any different from separate
> processes really? Each
> > thread is a separate interpreter with separate
> globals and this separate
> > Apache::DBI persistent handles. If things are not
> threadsafe it
> > crashes, but if they are it should work just like
> it does for
> > multi-process apache, shouldn't it?
>
> I think you are right. I was thinking about pooling
> across threads. If
> somebody can give it a try and report back (use
> debug mode to see what
> happens) that would be the simplest check.
>
> connect_on_init() should probably be not used.
I'm using DBD::ODBC to connect. I should have
mentioned that in the original post!
My main concern was that my application was moving
very slowly when it had to call Oracle. But thanks to
you guys I realized that the Apache::DBI call needs to
be called before DBI!! RTFM. Now my app is suddenly a
lot faster!!
Here's what's in my startup.pl file:
use Apache2 ();
use Apache::DBI ();
Apache::DBI->connect_on_init($dsn, $user, $pass,
\%h);
use ModPerl::Util ();
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();
use Apache::Server ();
use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();
use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';
use APR::Table ();
use Apache::compat ();
use ModPerl::Registry ();
use CGI ();
use CGI::Carp ();
use CGI::Application ();
use HTML::Template ();
$Apache::DBI::DEBUG = 2;
1;
Here's my httpd.conf with mod_perl LoadModule:
LoadFile "C:/Perl/bin/perl58.dll"
LoadModule perl_module modules/mod_perl.so
PerlOptions +Parent
PerlInterpMaxRequests 1
PerlInterpStart 1
PerlInterpMax 1
PerlRequire "C:/Apache2pl/conf/startup.pl"
Here's the error log immediatly after startup and
calling one web page ($dbh->trace(1) and
$Apache::DBI::DEBUG):
[Tue Jun 10 08:24:21 2003] [notice] Parent: Created
child process 2060
[Tue Jun 10 08:24:23 2003] [notice] Child 2060: Child
process is running
2060 Apache::DBI PerlChildInitHandler
2060 Apache::DBI need ping: yes
2060 Apache::DBI new connect to
'st1st1st1AutoCommit=1PrintError=1RaiseError=1'
[Tue Jun 10 08:24:24 2003] [notice] Child 2060:
Acquired the start mutex.
[Tue Jun 10 08:24:24 2003] [notice] Child 2060:
Starting 100 worker threads.
2060 Apache::DBI need ping: yes
2060 Apache::DBI new connect to
'st1st1st1AutoCommit=1PrintError=1RaiseError=1'
DBI 1.35-ithread dispatch trace level set to 1
-> DBI->Apache::DBI::connect(DBI:ODBC:st1, st1,
****)
<- FETCH('Name')= 'ODBC' ('Name' from cache) at
DBI.pm line 67
2060 Apache::DBI need ping: no
2060 Apache::DBI already connected to
'st1st1st1AutoCommit=1PrintError=1RaiseError=1'
<- STORE('RaiseError' 1)= 1 at DBI.pm line 615
<- STORE('PrintError' 1)= 1 at DBI.pm line 615
<- STORE('AutoCommit' 1)= 1 at DBI.pm line 615
<- connect= Apache::DBI::db=HASH(0x110779c)
<- STORE('dbi_connect_closure' CODE(0x10e3380))= 1
at DBI.pm line 632
<- STORE('LongReadLen' 22000)= 1 at CCCS.pm line
403
<- prepare('SELECT DISTINCT CONTENT_ID,
STANDARD_ID, STANDARD FROM tblCCCS WHERE CONTENT_ID =
? ORDER BY STANDARD_ID')= DBI::st=HASH(0x10e3278) at
CCCS.pm line 99
<- execute('3')= -1 at CCCS.pm line 100
2 <- FETCH('NAME')= [ 'CONTENT_ID' 'STANDARD_ID'
'STANDARD' ] at DBI.pm line 1682
2 <- fetch= [ '3' '1' '(Reading) All students will
understand and apply the knowledge of sounds, letters,
and words in written English to become independent and
fluent readers, and will read a variety of materials
and texts with fluency and comprehension.' ] row1 at
DBI.pm line 1682
1 <- fetchrow_hashref= HASH(0x1107910)3keys row1 at
DBI.pm line 1682
2 <- FETCH('NAME')= [ 'CONTENT_ID' 'STANDARD_ID'
'STANDARD' ] at DBI.pm line 1682
2 <- FETCH('NAME')= [ 'CONTENT_ID' 'STANDARD_ID'
'STANDARD' ] at DBI.pm line 1682
2 <- FETCH('NAME')= [ 'CONTENT_ID' 'STANDARD_ID'
'STANDARD' ] at DBI.pm line 1682
2 <- FETCH('NAME')= [ 'CONTENT_ID' 'STANDARD_ID'
'STANDARD' ] at DBI.pm line 1682
2 <- FETCH('NAME')= [ 'CONTENT_ID' 'STANDARD_ID'
'STANDARD' ] at DBI.pm line 1682
2 <- fetch= undef row5 at DBI.pm line 1682
1 <- fetchrow_hashref= undef row5 at DBI.pm line
1682
-> DBI->Apache::DBI::connect(DBI:ODBC:st1, st1,
****)
<- FETCH('Name')= 'ODBC' ('Name' from cache) at
DBI.pm line 67
2060 Apache::DBI need ping: no
2060 Apache::DBI already connected to
'st1st1st1AutoCommit=1PrintError=1RaiseError=1'
<- STORE('RaiseError' 1)= 1 at DBI.pm line 615
<- STORE('PrintError' 1)= 1 at DBI.pm line 615
<- STORE('AutoCommit' 1)= 1 at DBI.pm line 615
<- connect= Apache::DBI::db=HASH(0x110779c)
<- STORE('dbi_connect_closure' CODE(0x10e0b6c))= 1
at DBI.pm line 632
<- STORE('LongReadLen' 22000)= 1 at CCCS.pm line
403
-> DBI->Apache::DBI::connect(DBI:ODBC:st1, st1,
****)
<- FETCH('Name')= 'ODBC' ('Name' from cache) at
DBI.pm line 67
2060 Apache::DBI need ping: no
2060 Apache::DBI already connected to
'st1st1st1AutoCommit=1PrintError=1RaiseError=1'
<- STORE('RaiseError' 1)= 1 at DBI.pm line 615
<- STORE('PrintError' 1)= 1 at DBI.pm line 615
<- STORE('AutoCommit' 1)= 1 at DBI.pm line 615
<- connect= Apache::DBI::db=HASH(0x110779c)
<- STORE('dbi_connect_closure' CODE(0x10efc40))= 1
at DBI.pm line 632
<- STORE('LongReadLen' 22000)= 1 at CCCS.pm line
403
-> DBI->Apache::DBI::connect(DBI:ODBC:st1, st1,
****)
<- FETCH('Name')= 'ODBC' ('Name' from cache) at
DBI.pm line 67
2060 Apache::DBI need ping: no
2060 Apache::DBI already connected to
'st1st1st1AutoCommit=1PrintError=1RaiseError=1'
<- STORE('RaiseError' 1)= 1 at DBI.pm line 615
<- STORE('PrintError' 1)= 1 at DBI.pm line 615
<- STORE('AutoCommit' 1)= 1 at DBI.pm line 615
<- connect= Apache::DBI::db=HASH(0x110779c)
<- STORE('dbi_connect_closure' CODE(0x112ca9c))= 1
at DBI.pm line 632
<- STORE('LongReadLen' 22000)= 1 at CCCS.pm line
403
-> DBI->Apache::DBI::connect(DBI:ODBC:st1, st1,
****)
<- FETCH('Name')= 'ODBC' ('Name' from cache) at
DBI.pm line 67
2060 Apache::DBI need ping: no
2060 Apache::DBI already connected to
'st1st1st1AutoCommit=1PrintError=1RaiseError=1'
<- STORE('RaiseError' 1)= 1 at DBI.pm line 615
<- STORE('PrintError' 1)= 1 at DBI.pm line 615
<- STORE('AutoCommit' 1)= 1 at DBI.pm line 615
<- connect= Apache::DBI::db=HASH(0x110779c)
<- STORE('dbi_connect_closure' CODE(0x10e33c8))= 1
at DBI.pm line 632
<- STORE('LongReadLen' 22000)= 1 at CCCS.pm line
403
-> DBI->Apache::DBI::connect(DBI:ODBC:st1, st1,
****)
<- FETCH('Name')= 'ODBC' ('Name' from cache) at
DBI.pm line 67
...
Paul