[Mediawiki-l] Extensions and threading - how to bring your wiki to a halt

Daniel Barrett danb at VistaPrint.com
Fri Aug 22 19:02:52 UTC 2008


It seems that one slow extension can bring MediaWiki to a halt. For example, if you define a <wait> tag that simply sleeps for 20 seconds, and you hit a page that contains it, no other MediaWiki pages can be served during those 20 seconds.

Other PHP pages on the same Apache server, however, work just fine during those 20 seconds, so I'd guess this is not an Apache or PHP configuration issue.  Only MediaWiki pages are affected.

Although the <wait> tag is artificial, the situation is realistic.  We have a parser tag that hits an external database, and when the connection is slow (for even ONE wiki page), no other wiki pages can be served.

This seems dangerous.  What's happening, and what's the workaround?  This is in 1.13.0.  (And maybe it's my imagination, but the problem seemed less in 1.12.0.)

Here's my toy <wait> code:

<?php
# Wait for N seconds
$wgExtensionFunctions[] = 'wfWaitSetup';
function wfWaitSetup() {
  global $wgParser;
  $wgParser->setHook('wait', 'wfWait');
}
function wfWait($input) {
  global $wgParser;
  $wgParser->disableCache();
  sleep($input);
  return "Slept for $input seconds";
}

Thanks for any advice,
DanB



More information about the MediaWiki-l mailing list