From 92dee9c1574a4a3df340cdfb754d20610bac43b9 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 29 Jan 2008 02:55:02 +0000 Subject: [PATCH] Fix r30240: 2ms is an appropriate default for non-google-patch servers. 30s would be crazy for anyone, luckily it is measured in microseconds, not milliseconds. --- includes/DefaultSettings.php | 6 ++++++ includes/LoadBalancer.php | 10 ++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 0aef5327a6..e60dbafaaa 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -636,6 +636,12 @@ $wgDBerrorLog = false; /** When to give an error message */ $wgDBClusterTimeout = 10; +/** + * Scale load balancer polling time so that under overload conditions, the database server + * receives a SHOW STATUS query at an average interval of this many microseconds + */ +$wgDBAvgStatusPoll = 2000; + /** * wgDBminWordLen : * MySQL 3.x : used to discard words that MySQL will not return any results for diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index 185c6d35f9..0cdadd1e8e 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -16,12 +16,6 @@ class LoadBalancer { /* private */ var $mWaitForFile, $mWaitForPos, $mWaitTimeout; /* private */ var $mLaggedSlaveMode, $mLastError = 'Unknown error'; - /** - * Scale polling time so that under overload conditions, the database server - * receives a SHOW STATUS query at an average interval of this many microseconds - */ - const AVG_STATUS_POLL = 30000; - function __construct( $servers, $failFunction = false, $waitTimeout = 10, $waitForMasterNow = false ) { $this->mServers = $servers; @@ -133,7 +127,7 @@ class LoadBalancer { * Side effect: opens connections to databases */ function getReaderIndex() { - global $wgReadOnly, $wgDBClusterTimeout; + global $wgReadOnly, $wgDBClusterTimeout, $wgDBAvgStatusPoll; $fname = 'LoadBalancer::getReaderIndex'; wfProfileIn( $fname ); @@ -180,7 +174,7 @@ class LoadBalancer { # Too much load, back off and wait for a while. # The sleep time is scaled by the number of threads connected, # to produce a roughly constant global poll rate. - $sleepTime = self::AVG_STATUS_POLL * $status['Threads_connected']; + $sleepTime = $wgDBAvgStatusPoll * $status['Threads_connected']; # If we reach the timeout and exit the loop, don't use it $i = false; -- 2.20.1