From: Domas Mituzas Date: Tue, 10 Jan 2006 10:59:09 +0000 (+0000) Subject: miliseconds... X-Git-Tag: 1.6.0~644 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=44ab92339b8c15b15087aa0de070db55c79bff70;p=lhc%2Fweb%2Fwiklou.git miliseconds... * Do not check master lag * check just thread counts on SHOW STATUS, less bits on wire, less rows to handle for php --- diff --git a/includes/Database.php b/includes/Database.php index bfc8d1034d..71593e53d5 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -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; diff --git a/includes/DatabaseOracle.php b/includes/DatabaseOracle.php index f41f169d49..b934fa4eb7 100644 --- a/includes/DatabaseOracle.php +++ b/includes/DatabaseOracle.php @@ -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; } diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index e5bdb2608e..c3f87d42ca 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -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(); } }