From: Tim Starling Date: Tue, 20 Sep 2005 13:37:29 +0000 (+0000) Subject: Tweaked polling time X-Git-Tag: 1.6.0~1598 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=0d8eb4c99663a03618745231f075bc729c562423;p=lhc%2Fweb%2Fwiklou.git Tweaked polling time --- diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index 287ca8b92c..33cbe09118 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -19,6 +19,12 @@ define( 'DB_LAST', -3 ); # Whatever database was used last define( 'DB_READ', -1 ); define( 'DB_WRITE', -2 ); + +# Scale polling time so that under overload conditions, the database server +# receives a SHOW STATUS query at an average interval of this many microseconds +define( 'AVG_STATUS_POLL', 2000 ); + + /** * Database load balancing object * @@ -198,7 +204,7 @@ class LoadBalancer { $status['Threads_running'] > $this->mServers[$i]['max threads'] ) { # Slave is lagged, wait for a while - $sleepTime = 5000 * $status['Threads_connected']; + $sleepTime = AVG_STATUS_POLL * $status['Threads_connected']; # If we reach the timeout and exit the loop, don't use it $i = false;