MediaWiki  master
Wikimedia\Rdbms\LoadMonitorMySQL Class Reference

Basic MySQL load monitor with no external dependencies Uses memcached to cache the replication lag for a short time. More...

Inheritance diagram for Wikimedia\Rdbms\LoadMonitorMySQL:
Collaboration diagram for Wikimedia\Rdbms\LoadMonitorMySQL:

Public Member Functions

 __construct (ILoadBalancer $lb, BagOStuff $srvCache, WANObjectCache $wCache, array $options=[])
 
- Public Member Functions inherited from Wikimedia\Rdbms\LoadMonitor
 getLagTimes (array $serverIndexes, $domain)
 Get an estimate of replication lag (in seconds) for each server. More...
 
 scaleLoads (array &$weightByServer, $domain)
 Perform load ratio adjustment before deciding which server to use. More...
 
 setLogger (LoggerInterface $logger)
 
 setMockTime (&$time)
 

Protected Member Functions

 getWeightScale ( $index, IDatabase $conn=null)
 
- Protected Member Functions inherited from Wikimedia\Rdbms\LoadMonitor
 computeServerStates (array $serverIndexes, $domain, $priorStates)
 
 getCurrentTime ()
 
 getNewScaleViaMovingAve ( $lastScale, $naiveScale, $movAveRatio)
 Get the moving average weight scale given a naive and the last iteration value. More...
 
 getServerStates (array $serverIndexes, $domain)
 

Private Attributes

float $warmCacheRatio
 What buffer pool use ratio counts as "warm" (e.g. More...
 

Additional Inherited Members

- Protected Attributes inherited from Wikimedia\Rdbms\LoadMonitor
ILoadBalancer $lb
 
LoggerInterface $replLogger
 
BagOStuff $srvCache
 
WANObjectCache $wanCache
 

Detailed Description

Basic MySQL load monitor with no external dependencies Uses memcached to cache the replication lag for a short time.

Definition at line 33 of file LoadMonitorMySQL.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Rdbms\LoadMonitorMySQL::__construct ( ILoadBalancer  $lb,
BagOStuff  $srvCache,
WANObjectCache  $wCache,
array  $options = [] 
)
Parameters
ILoadBalancer$lb
BagOStuff$srvCache
WANObjectCache$wCache
array$options
  • movingAveRatio: moving average constant for server weight updates based on lag
  • lagWarnThreshold: how many seconds of lag trigger warnings

Reimplemented from Wikimedia\Rdbms\LoadMonitor.

Definition at line 37 of file LoadMonitorMySQL.php.

References Wikimedia\Rdbms\LoadMonitor\$lb, and Wikimedia\Rdbms\LoadMonitor\$srvCache.

Member Function Documentation

◆ getWeightScale()

Wikimedia\Rdbms\LoadMonitorMySQL::getWeightScale (   $index,
IDatabase  $conn = null 
)
protected
Parameters
int$indexServer index
IDatabase | null$connConnection handle or null on connection failure
Returns
float
Since
1.28

Reimplemented from Wikimedia\Rdbms\LoadMonitor.

Definition at line 45 of file LoadMonitorMySQL.php.

References $res, and $s.

Member Data Documentation

◆ $warmCacheRatio

float Wikimedia\Rdbms\LoadMonitorMySQL::$warmCacheRatio
private

What buffer pool use ratio counts as "warm" (e.g.

0.5 for 50% usage)

Definition at line 35 of file LoadMonitorMySQL.php.


The documentation for this class was generated from the following file: