MediaWiki master
|
Basic DB load monitor with no external dependencies. More...
Inherits Wikimedia\Rdbms\ILoadMonitor.
Inherited by Wikimedia\Rdbms\LoadMonitorNull.
Public Member Functions | |||||||||||||
__construct (ILoadBalancer $lb, BagOStuff $srvCache, WANObjectCache $wCache, $options) | |||||||||||||
Construct a new LoadMonitor with a given LoadBalancer parent.
| |||||||||||||
scaleLoads (array &$weightByServer) | |||||||||||||
Perform load ratio adjustment before deciding which server to use. | |||||||||||||
setLogger (LoggerInterface $logger) | |||||||||||||
setMockTime (&$time) | |||||||||||||
setStatsdDataFactory (StatsdDataFactoryInterface $statsFactory) | |||||||||||||
Sets a StatsdDataFactory instance on the object. | |||||||||||||
Protected Member Functions | |
computeServerState (int $i, ?array $previousState) | |
getCurrentTime () | |
getServerStates (array $serverIndexes) | |
getStateFromWanCache ( $i, ?array $srvPrevState) | |
makeStateKey (IStoreKeyEncoder $cache, int $i) | |
newInitialServerState () | |
Protected Attributes | |
ILoadBalancer | $lb |
LoggerInterface | $logger |
BagOStuff | $srvCache |
StatsdDataFactoryInterface | $statsd |
WANObjectCache | $wanCache |
Additional Inherited Members | |
Public Attributes inherited from Wikimedia\Rdbms\ILoadMonitor | |
const | STATE_AS_OF = 'time' |
const | STATE_CONN_COUNT = 'conn_count' |
const | STATE_UP = 'up' |
Basic DB load monitor with no external dependencies.
This uses both local server and local datacenter caches for DB server state information.
Definition at line 41 of file LoadMonitor.php.
Wikimedia\Rdbms\LoadMonitor::__construct | ( | ILoadBalancer | $lb, |
BagOStuff | $srvCache, | ||
WANObjectCache | $wCache, | ||
$options ) |
Construct a new LoadMonitor with a given LoadBalancer parent.
ILoadBalancer | $lb | LoadBalancer this instance serves |
BagOStuff | $sCache | Local server memory cache |
WANObjectCache | $wCache | Local cluster memory cache |
array | $options | Additional parameters include:
|
Implements Wikimedia\Rdbms\ILoadMonitor.
Definition at line 73 of file LoadMonitor.php.
References Wikimedia\Rdbms\LoadMonitor\$lb, and Wikimedia\Rdbms\LoadMonitor\$srvCache.
|
protected |
int | $i | |
array | null | $previousState |
DBAccessError |
Definition at line 221 of file LoadMonitor.php.
References Wikimedia\Rdbms\ILoadBalancer\CONN_SILENCE_ERRORS, Wikimedia\Rdbms\ILoadBalancer\CONN_UNTRACKED_GAUGE, and Wikimedia\Rdbms\ILoadBalancer\DOMAIN_ANY.
|
protected |
Definition at line 338 of file LoadMonitor.php.
|
protected |
Definition at line 150 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\scaleLoads().
|
protected |
Definition at line 177 of file LoadMonitor.php.
|
protected |
Definition at line 204 of file LoadMonitor.php.
References Wikimedia\ObjectCache\IStoreKeyEncoder\makeGlobalKey(), and Wikimedia\Rdbms\ServerInfo\WRITER_INDEX.
|
protected |
Definition at line 294 of file LoadMonitor.php.
Wikimedia\Rdbms\LoadMonitor::scaleLoads | ( | array & | $weightByServer | ) |
Perform load ratio adjustment before deciding which server to use.
array<int,int|float> | &$weightByServer Map of (server index => weight) |
Implements Wikimedia\Rdbms\ILoadMonitor.
Reimplemented in Wikimedia\Rdbms\LoadMonitorNull.
Definition at line 96 of file LoadMonitor.php.
References Wikimedia\Rdbms\LoadMonitor\getServerStates(), and Wikimedia\Rdbms\ILoadMonitor\STATE_CONN_COUNT.
Wikimedia\Rdbms\LoadMonitor::setLogger | ( | LoggerInterface | $logger | ) |
Definition at line 88 of file LoadMonitor.php.
References Wikimedia\Rdbms\LoadMonitor\$logger.
Wikimedia\Rdbms\LoadMonitor::setMockTime | ( | & | $time | ) |
float | null | &$time | Mock UNIX timestamp for testing |
Definition at line 346 of file LoadMonitor.php.
Wikimedia\Rdbms\LoadMonitor::setStatsdDataFactory | ( | StatsdDataFactoryInterface | $statsFactory | ) |
Sets a StatsdDataFactory instance on the object.
StatsdDataFactoryInterface | $statsFactory |
Implements Wikimedia\Stats\StatsdAwareInterface.
Definition at line 92 of file LoadMonitor.php.
|
protected |
Definition at line 43 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\__construct().
|
protected |
Definition at line 49 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\setLogger().
|
protected |
Definition at line 45 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\__construct().
|
protected |
Definition at line 51 of file LoadMonitor.php.
|
protected |
Definition at line 47 of file LoadMonitor.php.