MediaWiki REL1_28
|
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, BagOStuff $cache, array $options=[]) | |
Construct a new LoadMonitor with a given LoadBalancer parent. | |
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) | |
Public Attributes | |
const | VERSION = 1 |
Protected Member Functions | |
getServerStates (array $serverIndexes, $domain) | |
getWeightScale ( $index, IDatabase $conn=null) | |
Protected Attributes | |
BagOStuff | $mainCache |
ILoadBalancer | $parent |
LoggerInterface | $replLogger |
BagOStuff | $srvCache |
Private Member Functions | |
getCacheKey (array $serverIndexes) | |
Private Attributes | |
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 31 of file LoadMonitor.php.
LoadMonitor::__construct | ( | ILoadBalancer | $lb, |
BagOStuff | $sCache, | ||
BagOStuff | $cCache, | ||
array | $options = [] |
||
) |
Construct a new LoadMonitor with a given LoadBalancer parent.
ILoadBalancer | $lb | LoadBalancer this instance serves |
BagOStuff | $sCache | Local server memory cache |
BagOStuff | $cCache | Local cluster memory cache |
array | $options | Options map |
Implements ILoadMonitor.
Reimplemented in LoadMonitorMySQL.
Definition at line 46 of file LoadMonitor.php.
|
private |
Definition at line 205 of file LoadMonitor.php.
Referenced by getServerStates().
LoadMonitor::getLagTimes | ( | array | $serverIndexes, |
$domain | |||
) |
Get an estimate of replication lag (in seconds) for each server.
Values may be "false" if replication is too broken to estimate
integer[] | $serverIndexes | |
string | $domain |
Implements ILoadMonitor.
Definition at line 77 of file LoadMonitor.php.
References getServerStates().
|
protected |
Definition at line 83 of file LoadMonitor.php.
References $cache, $mainCache, $movingAveRatio, $value, as, getCacheKey(), getWeightScale(), and use.
Referenced by getLagTimes(), and scaleLoads().
|
protected |
integer | $index | Server index |
IDatabase | null | $conn | Connection handle or null on connection failure |
Reimplemented in LoadMonitorMySQL.
Definition at line 201 of file LoadMonitor.php.
Referenced by getServerStates().
LoadMonitor::scaleLoads | ( | array & | $weightByServer, |
$domain | |||
) |
Perform load ratio adjustment before deciding which server to use.
int[] | &$weightByServer | Map of (server index => float weight) |
string | bool | $domain |
Implements ILoadMonitor.
Definition at line 63 of file LoadMonitor.php.
References as, and getServerStates().
LoadMonitor::setLogger | ( | LoggerInterface | $logger | ) |
Definition at line 59 of file LoadMonitor.php.
|
protected |
Definition at line 37 of file LoadMonitor.php.
Referenced by getServerStates().
|
private |
Moving average ratio (e.g.
0.1 for 10% weight to new weight)
Definition at line 42 of file LoadMonitor.php.
Referenced by getServerStates().
|
protected |
Definition at line 33 of file LoadMonitor.php.
|
protected |
Definition at line 39 of file LoadMonitor.php.
|
protected |
Definition at line 35 of file LoadMonitor.php.
Referenced by __construct(), and LoadMonitorMySQL\__construct().
const LoadMonitor::VERSION = 1 |
Definition at line 44 of file LoadMonitor.php.