Help:Job queue

From the Tesseract Wiki, the wiki for all things Marvel Cinematic Universe
Jump to navigation Jump to search

The job queue performs long-running tasks asynchronously. The job queue is designed to hold many short tasks using batch processing.

Job examples[edit source]

Updating links tables when a template changes[edit source]

When a template changes, MediaWiki adds a job to the job queue for each article transcluding that template. Each job is a command to read an article, expand any templates, and update the link table accordingly. Previously, the host articles would remain outdated until either their parser cache expires or until a user edits the article.

HTML cache invalidation[edit source]

A wider class of operations can result in invalidation of the HTML cache for a large number of pages:

  • Changing an image (all the thumbnails have to be re-rendered, and their sizes recalculated)
  • Deleting a page (all the links to it from other pages need to change from blue to red)
  • Creating or undeleting a page (like above, but from red to blue)
  • Changing a template (all the pages that transclude the template need updating)

Except for template changes, these operations do not invalidate the links tables, but they do invalidate the HTML cache of all pages linking to that page, or using that image. Invalidating the cache of a page is a short operation; it only requires updating a single database field and sending a multicast packet to clear the caches. But if there are more than about 1000 to do, it takes a long time. By default, one job is added per 300 operations.

Note, however, that even if purging the cache of a page is a short operation, reparsing a complex page that is not in the cache may be expensive, specially if a highly used template is edited and causes lots of pages to be purged in a short period of time and your wiki has lots of concurrent visitors loading a wide spread of pages.

Typical values[edit source]

During a period of low load, the job queue might be zero. On the Tesseract wiki in off-peak hours, it might be near 0 but during a busy day it may be few hundred to a thousand but it can quickly fluctuate by 10% or more.

The current number of jobs in the queue can be viewed using the API: api.php ? action=query & meta=siteinfo & siprop=statistics (try in API sandbox).

See also[edit source]