From 0d8eb4c99663a03618745231f075bc729c562423 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 20 Sep 2005 13:37:29 +0000 Subject: [PATCH] Tweaked polling time --- includes/LoadBalancer.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; -- 2.20.1