MediaWiki
REL1_24
|
Version of PoolCounter that uses Redis. More...
Public Member Functions | |
__construct ($conf, $type, $key) | |
acquireForAnyone () | |
I want to do this task, but if anyone else does it instead, it's also fine for me. | |
acquireForMe () | |
I want to do this task and I need to do it myself. | |
release () | |
I have successfully finished my task. | |
Static Public Member Functions | |
static | releaseAll () |
Try to make sure that locks get released (even with exceptions and fatals) | |
Public Attributes | |
const | AWAKE_ALL = 2 |
const | AWAKE_ONE = 1 |
Protected Member Functions | |
getConnection () | |
getSlotListKey () | |
getSlotRTimeSetKey () | |
getWaitSetKey () | |
getWakeupListKey () | |
initAndPopPoolSlotList (RedisConnRef $conn, $now) | |
registerAcquisitionTime (RedisConnRef $conn, $slot, $now) | |
waitForSlotOrNotif ($doWakeup) | |
Protected Attributes | |
RedisConnRef | $conn |
* | |
string | $keySha1 |
SHA-1 of the key *. | |
int | $lockTTL |
TTL for locks to expire (work should finish in this time) *. | |
int | $onRelease |
AWAKE_* constant *. | |
RedisConnectionPool | $pool |
* | |
HashRing | $ring |
* | |
array | $serversByLabel |
(server label => host) map * | |
string | $session |
Unique string to identify this process *. | |
string | $slot |
Pool slot value *. | |
int | $slotTime |
UNIX timestamp *. | |
Static Protected Attributes | |
static | $active = null |
Version of PoolCounter that uses Redis.
There are four main redis keys used to track each pool counter key:
This class requires Redis 2.6 as it makes use Lua scripts for fast atomic operations. Also this should be on a server plenty of RAM for the working set to avoid evictions. Evictions could temporarily allow wait queues to double in size or temporarily cause pools to appear as full when they are not. Using volatile-ttl and bumping memory-samples in redis.conf can be helpful otherwise.
Definition at line 53 of file PoolCounterRedis.php.
PoolCounterRedis::__construct | ( | $ | conf, |
$ | type, | ||
$ | key | ||
) |
array | $conf | |
string | $type | |
string | $key |
Reimplemented from PoolCounter.
Definition at line 72 of file PoolCounterRedis.php.
References PoolCounter\$key, $type, key, and RedisConnectionPool\singleton().
I want to do this task, but if anyone else does it instead, it's also fine for me.
I will read its cached data.
Reimplemented from PoolCounter.
Definition at line 119 of file PoolCounterRedis.php.
I want to do this task and I need to do it myself.
Reimplemented from PoolCounter.
Definition at line 113 of file PoolCounterRedis.php.
PoolCounterRedis::getConnection | ( | ) | [protected] |
Definition at line 94 of file PoolCounterRedis.php.
References array().
PoolCounterRedis::getSlotListKey | ( | ) | [protected] |
Definition at line 369 of file PoolCounterRedis.php.
PoolCounterRedis::getSlotRTimeSetKey | ( | ) | [protected] |
Definition at line 376 of file PoolCounterRedis.php.
PoolCounterRedis::getWaitSetKey | ( | ) | [protected] |
Definition at line 383 of file PoolCounterRedis.php.
PoolCounterRedis::getWakeupListKey | ( | ) | [protected] |
Definition at line 390 of file PoolCounterRedis.php.
PoolCounterRedis::initAndPopPoolSlotList | ( | RedisConnRef $ | conn, |
$ | now | ||
) | [protected] |
RedisConnRef | $conn | |
float | $now | UNIX timestamp |
Definition at line 267 of file PoolCounterRedis.php.
PoolCounterRedis::registerAcquisitionTime | ( | RedisConnRef $ | conn, |
$ | slot, | ||
$ | now | ||
) | [protected] |
RedisConnRef | $conn | |
string | $slot | |
float | $now |
Definition at line 335 of file PoolCounterRedis.php.
I have successfully finished my task.
Lets another one grab the lock, and returns the workers waiting on acquireForAnyone()
Reimplemented from PoolCounter.
Definition at line 125 of file PoolCounterRedis.php.
static PoolCounterRedis::releaseAll | ( | ) | [static] |
Try to make sure that locks get released (even with exceptions and fatals)
Definition at line 397 of file PoolCounterRedis.php.
PoolCounterRedis::waitForSlotOrNotif | ( | $ | doWakeup | ) | [protected] |
int | $doWakeup | AWAKE_* constant |
Definition at line 207 of file PoolCounterRedis.php.
PoolCounterRedis::$active = null [static, protected] |
Definition at line 70 of file PoolCounterRedis.php.
RedisConnRef PoolCounterRedis::$conn [protected] |
*
Definition at line 60 of file PoolCounterRedis.php.
string PoolCounterRedis::$keySha1 [protected] |
SHA-1 of the key *.
Definition at line 57 of file PoolCounterRedis.php.
int PoolCounterRedis::$lockTTL [protected] |
TTL for locks to expire (work should finish in this time) *.
Definition at line 58 of file PoolCounterRedis.php.
int PoolCounterRedis::$onRelease [protected] |
AWAKE_* constant *.
Definition at line 62 of file PoolCounterRedis.php.
RedisConnectionPool PoolCounterRedis::$pool [protected] |
*
Definition at line 55 of file PoolCounterRedis.php.
HashRing PoolCounterRedis::$ring [protected] |
*
Definition at line 54 of file PoolCounterRedis.php.
array PoolCounterRedis::$serversByLabel [protected] |
(server label => host) map *
Definition at line 56 of file PoolCounterRedis.php.
string PoolCounterRedis::$session [protected] |
Unique string to identify this process *.
Definition at line 63 of file PoolCounterRedis.php.
string PoolCounterRedis::$slot [protected] |
Pool slot value *.
Definition at line 61 of file PoolCounterRedis.php.
int PoolCounterRedis::$slotTime [protected] |
UNIX timestamp *.
Definition at line 64 of file PoolCounterRedis.php.
const PoolCounterRedis::AWAKE_ALL = 2 |
Definition at line 67 of file PoolCounterRedis.php.
const PoolCounterRedis::AWAKE_ONE = 1 |
Definition at line 66 of file PoolCounterRedis.php.