miliseconds...
authorDomas Mituzas <midom@users.mediawiki.org>
Tue, 10 Jan 2006 10:59:09 +0000 (10:59 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Tue, 10 Jan 2006 10:59:09 +0000 (10:59 +0000)
* Do not check master lag
* check just thread counts on SHOW STATUS, less bits on wire, less rows to handle for php

includes/Database.php
includes/DatabaseOracle.php
includes/LoadBalancer.php

index bfc8d10..71593e5 100644 (file)
@@ -1653,8 +1653,8 @@ class Database {
        /**
         * Get status information from SHOW STATUS in an associative array
         */
-       function getStatus() {
-               $res = $this->query( 'SHOW STATUS' );
+       function getStatus($which="%") {
+               $res = $this->query( "SHOW STATUS LIKE '{$which}'" );
                $status = array();
                while ( $row = $this->fetchObject( $res ) ) {
                        $status[$row->Variable_name] = $row->Value;
index f41f169..b934fa4 100644 (file)
@@ -513,7 +513,7 @@ class DatabaseOracle extends Database {
        function getLag() {
                return false;
        }
-       function getStatus() {
+       function getStatus($which=null) {
                $result = array('Threads_running' => 0, 'Threads_connected' => 0);
                return $result;
        }
index e5bdb26..c3f87d4 100644 (file)
@@ -198,7 +198,7 @@ class LoadBalancer {
                                                        unset( $loads[$i] );
                                                        $sleepTime = 0;
                                                } else {
-                                                       $status = $this->mConnections[$i]->getStatus();
+                                                       $status = $this->mConnections[$i]->getStatus("Thread%");
                                                        if ( isset( $this->mServers[$i]['max threads'] ) &&
                                                          $status['Threads_running'] > $this->mServers[$i]['max threads'] )
                                                        {
@@ -615,7 +615,9 @@ class LoadBalancer {
 
                $times = array();
                foreach ( $this->mServers as $i => $conn ) {
-                       if ( $this->openConnection( $i ) ) {
+                       if ($i==0) { # Master
+                               $times[$i] = 0;
+                       } elseif ( $this->openConnection( $i ) ) {
                                $times[$i] = $this->mConnections[$i]->getLag();
                        }
                }