[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dbi-dev
Subject:    Re: Embperl/mod_perl/DSO again
From:       Tim Bunce <Tim.Bunce () ig ! co ! uk>
Date:       1999-09-30 14:59:36
[Download RAW message or body]

    *** From dbi-users -- To unsubscribe, see the end of this message. ***

On Thu, Sep 30, 1999 at 05:41:18PM +0400, BeerBong wrote:
> Hello all!
> 
> I'm still searching for the best solution for embedded script, many virtual
> hosts, and Oracle access from Apache.
> 
> Heh, I was surprised but Jamie O'Shaughnessy was right - PHP3 with Oracle
> support is not faster than DBI->DBD::Oracle,

Music to my ears :-)

> I tested on the same machine two identical scripts
> ./ab -n 1000 -c 10 http://apache/perl/test.pl
> ---------
> use strict;
> use DBI;
> 
> my ($dbh,$sth,$login,$fio);
> 
> print "Content-type: text/html\n\n";
> print "<HEAD><TITLE>DBTest</TITLE></HEAD>\n";
> print "<BODY>\n";
> print "<PRE>\n";
> 
> $dbh  = DBI->connect("DBI:Oracle:SIMain","test","test");
> $sth  = $dbh->prepare("select login,fio from test where login like ?");
> $sth->bind_param(1,"Be%");
> $sth->execute;
> $sth->bind_columns(\$login,\$fio);
> while ($sth->fetchrow_arrayref)
> {                                                                       
>     $login = '' unless defined $login;                                  
>     $fio   = '' unless defined $fio;                                    
>     print "$login - $fio \n";                                           
> }                                                                       
> print "</PRE></BODY></HTML>\n";                                         
> ---------

You could make that faster still (and closer to the php3 example below)
by putting "local $^W=0;" befor the while loop and removing the
"... unless defined ..." statements.

> ./ab -n 1000 -c 10 http://apache/test.php3
> ---------
> <?php
> print "<html><pre>";
> $c1 = ociplogon("test","test","SIMain");
> $stmnt = ociparse($c1,"select login,fio from test where login like 'Be%'");
> ociexecute($stmnt,OCI_DEFAULT);
> echo "------selecting\n\n";
> while (ocifetch($stmnt))
>    echo ociresult($stmnt,1)." - ".ociresult($stmnt,2)."\n";
> echo "------done\n\n";
> print "</pre></html>";
> ?>
> ---------
> 
> and results are the same (average - 23 requests/sec, difference is 0.1
> requests per second)... And what is more, that if connection to Oracle was
> broken, after resuming connection php3 returns error, but DBD::Oracle works
> correctly! Great! Forget about PHP...

:-)

And, if php3 doesn't support bind variables then it's bound to place a
significantly higher load on a busy Oracle server than DBD::Oracle
using placeholders (by forcing a higher rate of SQL cache churn).

Tim.

------------------------------------------------------------------------------
To unsubscribe from this list, please visit: http://www.isc.org/dbi-lists.html
If you are without web access, or if you are having trouble with the web page,
please send mail to dbi-users-request@isc.org with the subject line of
'unsubscribe'.
------------------------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic