MediaWiki REL1_27
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 LoadMonitorMySQL:
Collaboration diagram for LoadMonitorMySQL:

Public Member Functions

 __construct ( $parent)
 Construct a new LoadMonitor with a given LoadBalancer parent.
 
 clearCaches ()
 Clear any process and persistent cache of lag times.
 
 getLagTimes ( $serverIndexes, $wiki)
 Get an estimate of replication lag (in seconds) for each server.
 
 scaleLoads (&$loads, $group=false, $wiki=false)
 Perform pre-connection load ratio adjustment.
 

Public Attributes

LoadBalancer $parent
 

Protected Attributes

BagOStuff $mainCache
 
BagOStuff $srvCache
 

Private Member Functions

 getLagTimeCacheKey ()
 

Detailed Description

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

Definition at line 28 of file LoadMonitorMySQL.php.

Constructor & Destructor Documentation

◆ __construct()

LoadMonitorMySQL::__construct (   $parent)

Construct a new LoadMonitor with a given LoadBalancer parent.

Parameters
LoadBalancer$parent

Implements LoadMonitor.

Definition at line 36 of file LoadMonitorMySQL.php.

References $parent, ObjectCache\getLocalClusterInstance(), and ObjectCache\getLocalServerInstance().

Member Function Documentation

◆ clearCaches()

LoadMonitorMySQL::clearCaches ( )

Clear any process and persistent cache of lag times.

Since
1.27

Implements LoadMonitor.

Definition at line 135 of file LoadMonitorMySQL.php.

References getLagTimeCacheKey().

◆ getLagTimeCacheKey()

LoadMonitorMySQL::getLagTimeCacheKey ( )
private

Definition at line 141 of file LoadMonitorMySQL.php.

Referenced by clearCaches(), and getLagTimes().

◆ getLagTimes()

LoadMonitorMySQL::getLagTimes (   $serverIndexes,
  $wiki 
)

Get an estimate of replication lag (in seconds) for each server.

Values may be "false" if replication is too broken to estimate

Parameters
array$serverIndexes
string$wiki
Returns
array Map of (server index => float|int|bool)

Implements LoadMonitor.

Definition at line 46 of file LoadMonitorMySQL.php.

References $cache, $i, $mainCache, $value, as, getLagTimeCacheKey(), use, and wfDebugLog().

◆ scaleLoads()

LoadMonitorMySQL::scaleLoads ( $loads,
  $group = false,
  $wiki = false 
)

Perform pre-connection load ratio adjustment.

Parameters
array&$loads
string | bool$groupThe selected query group. Default: false
string | bool$wikiDefault: false

Implements LoadMonitor.

Definition at line 43 of file LoadMonitorMySQL.php.

Member Data Documentation

◆ $mainCache

BagOStuff LoadMonitorMySQL::$mainCache
protected

Definition at line 34 of file LoadMonitorMySQL.php.

Referenced by getLagTimes().

◆ $parent

LoadBalancer LoadMonitorMySQL::$parent

Definition at line 30 of file LoadMonitorMySQL.php.

Referenced by __construct().

◆ $srvCache

BagOStuff LoadMonitorMySQL::$srvCache
protected

Definition at line 32 of file LoadMonitorMySQL.php.


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