Page MenuHomePhabricator

MediaWiki starts external PHP on every request - even if job queue is empty
Closed, ResolvedPublic

Description

Probably since https://gerrit.wikimedia.org/r/#/c/59797/ job handling starts an external php process by default.

This happens even if the job queue is empty.

Is this intentional? I somehow doubt starting a php interpreter just to find out it's empty won't improve performance...

I'm quite sure checking the database if there are jobs to run won't be too "expensive", and can avoid lots of more expensive PHP interpreter starts ;-)


Version: 1.22.0
Severity: normal

Details

Reference
bz60210

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:05 AM
bzimport set Reference to bz60210.

I can confirm this bug.

Setting $wgPhpCli to a bash script that writes a line to a log file, on a development wiki with no edits and an empty job table, loading any page gives a new line on the log.

Change 113038 merged by jenkins-bot:
Moved job running via $wgJobRunRate to a special API

https://gerrit.wikimedia.org/r/113038

(In reply to Gerrit Notification Bot from comment #2)

Change 113038 merged by jenkins-bot:
Moved job running via $wgJobRunRate to a special API

https://gerrit.wikimedia.org/r/113038

This doesn't fix anything. It doesn't open a new shell, but makes a new api call even if there's no job in the queue.

Whith the default value of $wgJobRunRate = 1, that means every page request to MediaWiki is translated to 2 separate HTTP requests that the server must handle, with all the memory consumption that they involve.

Change 124629 had a related patch set uploaded by Aaron Schulz:
Backoff doing job run requests when the queue is empty

https://gerrit.wikimedia.org/r/124629

Change 124629 had a related patch set uploaded by Ori.livneh:
Avoid making a derivative request to Special:RunJobs when the job queue is empty

https://gerrit.wikimedia.org/r/124629

Change 124629 merged by jenkins-bot:
Avoid making a derivative request to Special:RunJobs when the job queue is empty

https://gerrit.wikimedia.org/r/124629

As of change Icb95c35f4, MediaWiki is smart enough to check that the queue is nonempty before spawning another request. And for those cases where resource constraints make the cost of an additional request prohibitive, I892a36082 added $wgRunJobsAsync, which can be used to disable parallelism altogether.