|
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, LoggerInterface $logger, StatsFactory $statsFactory, $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) | |||||||||||||||||||
Protected Member Functions | |
| computeServerState (int $i, ?array $previousState) | |
| getCurrentTime () | |
| getServerStates (array $serverIndexes) | |
| getStateFromWanCache (int $i, ?array $srvPrevState) | |
| makeStateKey (IStoreKeyEncoder $cache, int $i) | |
| newInitialServerState () | |
Protected Attributes | |
| ILoadBalancer | $lb |
| LoggerInterface | $logger |
| BagOStuff | $srvCache |
| StatsFactory | $statsFactory |
| 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 25 of file LoadMonitor.php.
| Wikimedia\Rdbms\LoadMonitor::__construct | ( | ILoadBalancer | $lb, |
| BagOStuff | $srvCache, | ||
| WANObjectCache | $wCache, | ||
| LoggerInterface | $logger, | ||
| StatsFactory | $statsFactory, | ||
| $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 |
| LoggerInterface | $logger | PSR-3 logger instance |
| StatsFactory | $statsFactory | StatsFactory instance |
| array | $options | Additional parameters include:
|
Implements Wikimedia\Rdbms\ILoadMonitor.
Definition at line 57 of file LoadMonitor.php.
References Wikimedia\Rdbms\LoadMonitor\$lb, Wikimedia\Rdbms\LoadMonitor\$logger, Wikimedia\Rdbms\LoadMonitor\$srvCache, and Wikimedia\Rdbms\LoadMonitor\$statsFactory.
|
protected |
| int | $i | |
| array | null | $previousState |
| DBAccessError |
Definition at line 208 of file LoadMonitor.php.
|
protected |
Definition at line 326 of file LoadMonitor.php.
|
protected |
Definition at line 137 of file LoadMonitor.php.
|
protected |
Definition at line 164 of file LoadMonitor.php.
|
protected |
Definition at line 191 of file LoadMonitor.php.
|
protected |
Definition at line 284 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 83 of file LoadMonitor.php.
| Wikimedia\Rdbms\LoadMonitor::setLogger | ( | LoggerInterface | $logger | ) |
Definition at line 79 of file LoadMonitor.php.
| Wikimedia\Rdbms\LoadMonitor::setMockTime | ( | & | $time | ) |
| float | null | &$time | Mock UNIX timestamp for testing |
Definition at line 334 of file LoadMonitor.php.
|
protected |
Definition at line 27 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\__construct().
|
protected |
Definition at line 33 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\__construct().
|
protected |
Definition at line 29 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\__construct().
|
protected |
Definition at line 35 of file LoadMonitor.php.
Referenced by Wikimedia\Rdbms\LoadMonitor\__construct().
|
protected |
Definition at line 31 of file LoadMonitor.php.