From: Tim Starling Date: Tue, 29 Jan 2008 02:55:02 +0000 (+0000) Subject: Fix r30240: 2ms is an appropriate default for non-google-patch servers. 30s would... X-Git-Tag: 1.31.0-rc.0~49726 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=92dee9c1574a4a3df340cdfb754d20610bac43b9;p=lhc%2Fweb%2Fwiklou.git 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. --- 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;