Freakolowsky has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/65279


Change subject: Added DRCP and persistent connections support for Oracle
......................................................................

Added DRCP and persistent connections support for Oracle

Change-Id: I2be7120a2ebec39d866b79be62ac715bbc3738a9
---
M includes/DefaultSettings.php
M includes/db/DatabaseOracle.php
2 files changed, 36 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/79/65279/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 9221784..7160f89 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -1590,6 +1590,35 @@
 $wgDBmysql5 = false;
 
 /**
+ * Set true to enable Oracle DCRP (suported from 11gR1 onward)
+ * 
+ * When it comes to frequent shortlived DB connections like with MW
+ * Oracle tends to s***. The problem is the driver connects to the 
+ * database reasonably fast, but establishing a session takes time and
+ * resources. MW does not rely on session state (as it does not use 
+ * features such as package variables) so establishing a valid session
+ * is in this case an unwanted overhead that just slows things down.
+ * 
+ * Starting from 11gR1 you can use DCRP (Database Resident Connection
+ * Pool) that maintains established sessions and reuses them on new 
+ * connections.
+ * 
+ * To use this feature set to true and use a datasource defined as 
+ * POOLED (in tnsnames definition set server=pooled in connect_data
+ * block).
+ * 
+ * Not completely tested, but it shuld fall back on normal connection 
+ * in case the pool is full or the datasource is not configured as 
+ * pooled.
+ * And the other way around; using oci_pconnect on a non pooled 
+ * datasource should produce a normal connection.
+ * 
+ * @warning EXPERIMENTAL!
+ *
+ */
+$wgDBOracleDCRP = false;
+
+/**
  * Other wikis on this site, can be administered from a single developer
  * account.
  * Array numeric key => database name
diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php
index 4fa2397..9e0af3f 100644
--- a/includes/db/DatabaseOracle.php
+++ b/includes/db/DatabaseOracle.php
@@ -249,6 +249,7 @@
         * @return DatabaseBase|null
         */
        function open( $server, $user, $password, $dbName ) {
+                global $wgDBOracleDCRP;
                if ( !function_exists( 'oci_connect' ) ) {
                        throw new DBConnectionError( $this, "Oracle functions 
missing, have you compiled PHP with the --with-oci8 option?\n (Note: if you 
recently installed PHP, you may need to restart your webserver and database)\n" 
);
                }
@@ -276,9 +277,14 @@
                        return;
                }
 
+                if ( $wgDBOracleDCRP ) $this->setFlag( DBO_PERSISTENT );
+
                $session_mode = $this->mFlags & DBO_SYSDBA ? OCI_SYSDBA : 
OCI_DEFAULT;
+                
                wfSuppressWarnings();
-               if ( $this->mFlags & DBO_DEFAULT ) {
+               if ( $this->mFlags & DBO_PERSISTENT ) {
+                       $this->mConn = oci_pconnect( $this->mUser, 
$this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );
+               } else if ( $this->mFlags & DBO_DEFAULT ) {
                        $this->mConn = oci_new_connect( $this->mUser, 
$this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );
                } else {
                        $this->mConn = oci_connect( $this->mUser, 
$this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );

-- 
To view, visit https://gerrit.wikimedia.org/r/65279
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2be7120a2ebec39d866b79be62ac715bbc3738a9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Freakolowsky <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to