Manual:Job queue

Set up [ edit ]
By default, jobs are run at the end of a web request. If possible, it is recommended that you disable this default behaviour by setting  to , and instead schedule the running of jobs completely in the background, via the command line.

Warning: Running jobs once a day like that could be very problematic for consistency and responsiveness -- you should instead run jobs as soon as possible after they are queued, using a wrapper script that waits for jobs to be queued and runs the appropriate job runners.

@FIXME: detail the actual wrappers Wikimedia uses in production to run jobs.

Note: you should run  as the same user as the web server runs as, to ensure that permissions to the filesystem are correctly accounted for if jobs touch uploaded files.

Simple service to run jobs
If you have shell access and the possibility to create init scripts, you can create a simple service to run jobs as they become available, and also throttle them to prevent the job runner to monopolize the CPU resources of the server:

Create a bash script, for example at :

Depending on how fast the server is and the load it handles, you can adapt the number of jobs to run on each cycle and the number of seconds to wait on each cycle.

Make the script executable.

If using systemd, create a new service unit by creating the file. Change the  parameter to the user that runs PHP on your web server:

Enable it and start it with those commands: