Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/265477
Change subject: [WIP] Make $wgJobBackoffThrottling a bit less aggressive
......................................................................
[WIP] Make $wgJobBackoffThrottling a bit less aggressive
Let it overrun a bit before terminating workers.
Change-Id: I7b0dcfa00df5060aad5f91ca9111879909906341
---
M includes/jobqueue/JobRunner.php
1 file changed, 19 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/77/265477/1
diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php
index 4ab9f5a..a6ba887 100644
--- a/includes/jobqueue/JobRunner.php
+++ b/includes/jobqueue/JobRunner.php
@@ -43,6 +43,7 @@
const MAX_ALLOWED_LAG = 3; // abort if more than this much DB lag is
present
const LAG_CHECK_PERIOD = 1.0; // check slave lag this many seconds
const ERROR_BACKOFF_TTL = 1; // seconds to back off a queue due to
errors
+ const BACKOFF_THRESHOLD = 10; // apply backoffs in this thread when
they reach this point
/**
* @param callable $debug Optional debug output handler
@@ -142,7 +143,7 @@
do {
// Sync the persistent backoffs with concurrent runners
$backoffs = $this->syncBackoffDeltas( $backoffs,
$backoffDeltas, $wait );
- $blacklist = $noThrottle ? array() : array_keys(
$backoffs );
+ $blacklist = $noThrottle ? array() :
$this->getBackoffBlacklist( $backoffs );
$wait = 'nowait'; // less important now
if ( $type === false ) {
@@ -349,6 +350,23 @@
}
/**
+ * @param array $backoffs Map of (job type => UNIX timestamp)
+ * @return array List of job types to avoid
+ */
+ private function getBackoffBlacklist( array $backoffs ) {
+ $now = time();
+
+ $blacklist = array();
+ foreach ( $backoffs as $type => $timestamp ) {
+ if ( ( $timestamp - $now ) > self::BACKOFF_THRESHOLD ) {
+ $blacklist[] = $type;
+ }
+ }
+
+ return $blacklist;
+ }
+
+ /**
* Get the previous backoff expiries from persistent storage
* On I/O or lock acquisition failure this returns the original
$backoffs.
*
--
To view, visit https://gerrit.wikimedia.org/r/265477
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b0dcfa00df5060aad5f91ca9111879909906341
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits