Manual:Maxlag parameter

From MediaWiki.org
(Redirected from Maxlag)
Jump to: navigation, search

If you are running MediaWiki on a replicated database cluster (like Wikimedia is), then high edit rates may cause the slave servers to lag. One way to mitigate slave lag is to have all bots and maintenance tasks automatically stop whenever lag goes above a certain value. In a server side script this is done using wfWaitForSlaves(). In MediaWiki 1.10, the maxlag parameter was introduced which allows the same thing to be done in client-side scripts.

The maxlag parameter can be passed to index.php through a URL parameter, POST data or a cookie. It is an integer number of seconds. For example, this link edits this page unless the lag is greater than 1 second.

If the specified lag is exceeded at the time of the request, a 503 status code is returned, with a response body with the following format:

Waiting for $host: $lag seconds lagged\n

The following HTTP headers are set:

Recommended usage for Wikimedia wikis is as follows:

Note that Squid may also generate error messages with a 503 status code, due to timeout of an upstream server. Clients should treat these errors differently, because they may occur consistently when you try to perform a long-running expensive operation. Repeating the operation on timeout would use excessive server resources and may leave your client in an infinite loop. You can distinguish between squid errors and MediaWiki lag conditions using any of the following:

For testing purposes, you may intentionally make the software refuse a request by passing a negative value, such as in the following URL: [1].

The maxlag parameter is checked in index.php, and also applies to the API.

Language: English  • 日本語
Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Toolbox