MediaWiki  1.27.2
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. More...
 
 clearCaches ()
 Clear any process and persistent cache of lag times. More...
 
 getLagTimes ($serverIndexes, $wiki)
 Get an estimate of replication lag (in seconds) for each server. More...
 
 scaleLoads (&$loads, $group=false, $wiki=false)
 Perform pre-connection load ratio adjustment. More...
 

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

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

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 $key, and getLagTimeCacheKey().

LoadMonitorMySQL::getLagTimeCacheKey ( )
private

Definition at line 141 of file LoadMonitorMySQL.php.

Referenced by clearCaches(), and 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, $key, $mainCache, $value, as, getLagTimeCacheKey(), use, and wfDebugLog().

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

BagOStuff LoadMonitorMySQL::$mainCache
protected

Definition at line 34 of file LoadMonitorMySQL.php.

Referenced by getLagTimes().

LoadBalancer LoadMonitorMySQL::$parent

Definition at line 30 of file LoadMonitorMySQL.php.

Referenced by __construct().

BagOStuff LoadMonitorMySQL::$srvCache
protected

Definition at line 32 of file LoadMonitorMySQL.php.


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