手册:$wgJobRunRate

This page is a translated version of the page Manual:$wgJobRunRate and the translation is 69% complete.
作业: $wgJobRunRate
每个请求要执行的作业数。
引进版本:1.6.0 (r13088)
移除版本:仍在使用
允许的值:(数字 >= 0)
默认值:1

细节

每个请求要执行的作业数。 May be less than one in which case jobs are performed probabilistically. If this is 0, jobs will not be done during ordinary Apache requests. In this case, maintenance/runJobs.php should be run in loop every few seconds via a service or cron job. If using a cron job, be sure to handle the case where the script is already running (e.g. via "/usr/bin/flock -n <lock_file>"). If this is set to a non-zero number, then it is highly recommended that PHP run in fastcgi mode (php_fpm). When using a standard Apache PHP handler (mod_php), it is recommended that output_buffering and zlib.output_compression both be set to "Off", allowing MediaWiki to install an unlimited size output buffer on the fly. Setting output_buffering to an integer (e.g. 4096) or enabling zlib.output_compression can cause user-visible slowness as background tasks execute during web requests. Regardless of the web server engine in use, be sure to configure a sufficient number processes/threads in order to avoid exhaustion (which will cause user-visible slowness).

原因

作业队列设计用于容纳许多短任务。 默认情况下,每次运行请求时,都会从作业队列中取出一个作业并执行。 如果这样做的性能负担太大,您可以通过在LocalSettings.php 中设置一些内容来减少$wgJobRunRate:

$wgJobRunRate = 0.01;

这将导致作业队列中的一个项目平均每100次页面访问运行一次。 重要的是要理解,这意味着在每次页面访问上,运行排队项目的可能性是1/100。 这意味着(至少在理论上)你仍然可以在每次页面访问时运行一个作业,或者(另一个极端)根本没有运行任何作业。 然而,在实践中,如果您有足够的流量来制作有意义的样本大小,那么它应该是大约每100个请求处理1个。

在某些版本的MediaWiki中,您可以在Special:Statistics查看作业数。 然而,这个数字是一个粗略的估计,因此具有误导性,因此在1.17 (r65059)中删除了它。

在以后的版本中,您仍然可以通过调用API来查看它:


作业队列位于MediaWiki.php 函数triggerJobs()(1.23之前的doJobs())中。

参见