MediaWiki REL1_34
|
Basic DB load monitor with no external dependencies Uses memcached to cache the replication lag for a short time. More...
Public Member Functions | |
__construct (ILoadBalancer $lb, BagOStuff $srvCache, WANObjectCache $wCache, array $options=[]) | |
getLagTimes (array $serverIndexes, $domain) | |
Get an estimate of replication lag (in seconds) for each server. | |
scaleLoads (array &$weightByServer, $domain) | |
Perform load ratio adjustment before deciding which server to use. | |
setLogger (LoggerInterface $logger) | |
Protected Member Functions | |
getServerStates (array $serverIndexes, $domain) | |
getWeightScale ( $index, IDatabase $conn=null) | |
Protected Attributes | |
ILoadBalancer | $lb |
LoggerInterface | $replLogger |
BagOStuff | $srvCache |
WANObjectCache | $wanCache |
Private Member Functions | |
getCacheKey (array $serverIndexes) | |
Private Attributes | |
int | $lagWarnThreshold |
Amount of replication lag in seconds before warnings are logged. | |
float | $movingAveRatio |
Moving average ratio (e.g. | |
Basic DB load monitor with no external dependencies Uses memcached to cache the replication lag for a short time.
Definition at line 36 of file LoadMonitor.php.
Wikimedia\Rdbms\LoadMonitor::__construct | ( | ILoadBalancer | $lb, |
BagOStuff | $srvCache, | ||
WANObjectCache | $wCache, | ||
array | $options = [] |
||
) |
ILoadBalancer | $lb | |
BagOStuff | $srvCache | |
WANObjectCache | $wCache | |
array | $options |
|
Implements Wikimedia\Rdbms\ILoadMonitor.
Reimplemented in Wikimedia\Rdbms\LoadMonitorMySQL.
Definition at line 64 of file LoadMonitor.php.
References Wikimedia\Rdbms\LoadMonitor\$lb, and Wikimedia\Rdbms\LoadMonitor\$srvCache.
|
private |
Definition at line 234 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\getServerStates().
|
final |
Get an estimate of replication lag (in seconds) for each server.
Values may be "false" if replication is too broken to estimate
int[] | $serverIndexes | |
string | $domain |
Implements Wikimedia\Rdbms\ILoadMonitor.
Definition at line 94 of file LoadMonitor.php.
References Wikimedia\Rdbms\LoadMonitor\getServerStates().
|
protected |
Definition at line 98 of file LoadMonitor.php.
References Wikimedia\Rdbms\LoadMonitor\$movingAveRatio, Wikimedia\Rdbms\LoadMonitor\$srvCache, Wikimedia\Rdbms\LoadMonitor\getCacheKey(), and Wikimedia\Rdbms\LoadMonitor\getWeightScale().
Referenced by Wikimedia\Rdbms\LoadMonitor\getLagTimes(), and Wikimedia\Rdbms\LoadMonitor\scaleLoads().
|
protected |
int | $index | Server index |
IDatabase | null | $conn | Connection handle or null on connection failure |
Reimplemented in Wikimedia\Rdbms\LoadMonitorMySQL.
Definition at line 230 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\getServerStates().
|
final |
Perform load ratio adjustment before deciding which server to use.
int[] | &$weightByServer | Map of (server index => float weight) |
string | bool | $domain |
Implements Wikimedia\Rdbms\ILoadMonitor.
Definition at line 80 of file LoadMonitor.php.
References Wikimedia\Rdbms\LoadMonitor\getServerStates().
Wikimedia\Rdbms\LoadMonitor::setLogger | ( | LoggerInterface | $logger | ) |
Definition at line 76 of file LoadMonitor.php.
|
private |
Amount of replication lag in seconds before warnings are logged.
Definition at line 49 of file LoadMonitor.php.
|
protected |
Definition at line 38 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\__construct(), and Wikimedia\Rdbms\LoadMonitorMySQL\__construct().
|
private |
Moving average ratio (e.g.
0.1 for 10% weight to new weight)
Definition at line 47 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\getServerStates().
|
protected |
Definition at line 44 of file LoadMonitor.php.
|
protected |
Definition at line 40 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\__construct(), Wikimedia\Rdbms\LoadMonitorMySQL\__construct(), and Wikimedia\Rdbms\LoadMonitor\getServerStates().
|
protected |
Definition at line 42 of file LoadMonitor.php.