Edit report at http://bugs.php.net/bug.php?id=51610&edit=1
ID: 51610
Comment by: marioroy at verizon dot net
Reported by: marioroy at verizon dot net
Summary: 1 second+ needed for OCI8 versus PDO/oci to open/close
connection and exit
Status: Wont fix
Type: Bug
Package: OCI8 related
Operating System: Linux & Snow Leopard
PHP Version: 5.3SVN-2010-04-20 (snap)
Assigned To: sixd
New Comment:
I have applied this patch to oci8.c. It resolves the issue for me. I
set
use_spool to 0. Can we have use_spool enabled/disabled via an oci8.ini
directive. Thanks.
@@ -1711,7 +1693,7 @@
smart_str hashed_details = {0};
time_t timestamp;
php_oci_spool *session_pool = NULL;
- zend_bool use_spool = 1; /* Default is to use
client-side
session pool */
+ zend_bool use_spool = 0; /* Default is to use
client-side
session pool */
zend_bool ping_done = 0;
Previous Comments:
------------------------------------------------------------------------
[2010-06-18 04:19:45] [email protected]
The PHP OCI8 code changes in question have been in production for two
years. They were introduced to support Database Resident Connection
Pooling and FAN for scalability in web apps. The dominant use cases
for SQL*Plus and PHP are very different.
------------------------------------------------------------------------
[2010-06-17 15:29:25] chris at leaflock dot net
I filed a duplicate bug, but I noticed something unique; It doesn't
happen with Oracle 10.2.0.3.
I'm pretty unhappy about this, what is the benefit and/or requirement
for this behavior, and why does it not happen in 10.2.0.3?
Oracle's own SQLPlus doesn't display this behavior. I never thought I'd
see the day when SQLPlus could do something faster for me than PHP.
------------------------------------------------------------------------
[2010-04-22 00:33:09] marioroy at verizon dot net
Thank you for the feedback.
------------------------------------------------------------------------
[2010-04-21 18:31:34] [email protected]
This is expected. There is a shutdown cost at process termination from
closing
a timer thread needed by the connection rearchitecture of OCI8 1.3.
Most deployments either do not start and stop PHP processes frequently,
or are
not sensitive to the time between completing the work of the script and
the
termination of the process.
It's possible that PDO_OCI may be changed in future and might get the
same
behaviour.
------------------------------------------------------------------------
[2010-04-20 05:24:44] marioroy at verizon dot net
Description:
------------
Is this normal to see the native OCI8 1.3.5 or later requiring
additional time to
run code snippet shown below when accessing Oracle 10.2.0.4. I'm seeing
this at
work as well (SUSE Linux). Therefore, I have stayed with OCI8 1.2.5 for
the
moment.
Notice how the time is the same when using the PDO/OCI interface.
Test script:
---------------
# Native OCI8 Performance:
#
# PHP 5.2.14 201004191430, OCI8 1.2.5: ~ 0.15 seconds ;this is nice
#
# PHP 5.3.3 201004191430, OCI8 1.2.5: ~ 0.25 seconds ;takes 0.1 extra
here
# PHP 5.3.3 201004191430, OCI8 1.3.5: ~ 1.20 seconds ;slowness begins
when
# PHP 5.3.3 201004191430, OCI8 1.4.1: ~ 1.20 seconds ;script exits for
1.3.5+
# PHP 5.3.3 201004191430, OCI8 1.4.2: ~ 1.20 seconds
<?php
$conn = oci_connect('hr', 'hr', '//localhost:1521/mac10g');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES),
E_USER_ERROR);
}
oci_close($conn);
exit;
?>
# PDO/OCI Performance:
#
# PHP 5.2.14 201004191430, OCI8 1.2.5: ~ 0.15 seconds ;very fast
#
# PHP 5.3.3 201004191430, OCI8 1.2.5: ~ 0.15 seconds ;same as PHP
5.2.14 :)
# PHP 5.3.3 201004191430, OCI8 1.3.5: ~ 0.15 seconds ;very happy to
see this
# PHP 5.3.3 201004191430, OCI8 1.4.1: ~ 0.15 seconds ;with 1.3.5+
# PHP 5.3.3 201004191430, OCI8 1.4.2: ~ 0.15 seconds
<?php
try {
$conn = new PDO('oci:dbname=127.0.0.1/mac10g', 'hr', 'hr');
}
catch (PDOException $e) {
trigger_error("Could not connect to database: ". $e->getMessage(),
E_USER_ERROR);
}
$conn = NULL;
exit;
?>
Expected result:
----------------
I'm hoping that PHP 5.3.2+ with OCI8 1.4.1+ can perform as fast as PHP
5.2.13 with
OCI8 1.2.5 when using the native driver. This is why I have stayed with
1.2.5 at
work.
It wasn't until tonight that I saw the times the same via the PDO
interface. That
made my day.
Actual result:
--------------
The native OCI8 1.3.5+ requires extra time to open/close and exit. The
time delta
is 1 second for such a small code snippet.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51610&edit=1