wiki.techinc.nl/includes/libs/objectcache
2022-03-24 15:24:54 +00:00
..
serialized Fix more libs PSR12.Properties.ConstantVisibility.NotFound 2020-05-16 20:13:22 +00:00
utils Consistently use @deprecated since rather @deprecated 2022-03-06 02:55:54 +00:00
wancache Merge "objectcache: Warn when WANObjectCache callback returns incomplete result" 2022-03-24 15:24:54 +00:00
APCUBagOStuff.php objectcache: deprecate BagOStuff incr() and decr() methods 2022-02-18 11:15:27 +11:00
BagOStuff.php cache: Fix various scalar and null types to match documentation 2022-03-14 17:36:04 +00:00
CachedBagOStuff.php objectcache: deprecate BagOStuff incr() and decr() methods 2022-02-18 11:15:27 +11:00
EmptyBagOStuff.php objectcache: deprecate BagOStuff incr() and decr() methods 2022-02-18 11:15:27 +11:00
HashBagOStuff.php objectcache: deprecate BagOStuff incr() and decr() methods 2022-02-18 11:15:27 +11:00
IStoreKeyEncoder.php objectcache: add statsd key metrics to BagOStuff classes 2021-01-25 14:36:29 -08:00
MediumSpecificBagOStuff.php cache: Fix various scalar and null types to match documentation 2022-03-14 17:36:04 +00:00
MemcachedBagOStuff.php objectcache: simplify BagOStuff::ATTR_* flags and set them for backends 2021-08-31 11:23:28 -07:00
MemcachedPeclBagOStuff.php Fix various documentation related to false 2022-03-03 21:33:31 +01:00
MemcachedPhpBagOStuff.php phan: Disable null_casts_as_any_type setting 2022-03-21 18:25:07 +00:00
MultiWriteBagOStuff.php Use updated ObjectFactory namespace 2022-03-09 23:04:51 +00:00
README.md objectcache: Improve the metrics README for wanobjectcache 2021-09-10 19:23:29 +00:00
RedisBagOStuff.php cache: Fix various scalar and null types to match documentation 2022-03-14 17:36:04 +00:00
ReplicatedBagOStuff.php Use updated ObjectFactory namespace 2022-03-09 23:04:51 +00:00
RESTBagOStuff.php cache: Fix various scalar and null types to match documentation 2022-03-14 17:36:04 +00:00
WinCacheBagOStuff.php objectcache: deprecate BagOStuff incr() and decr() methods 2022-02-18 11:15:27 +11:00

wikimedia/objectcache

Statistics

Sent to StatsD under MediaWiki's namespace.

WANObjectCache

The default WANObjectCache provided by MediaWikiServices disables these statistics in processes where $wgCommandLineMode is true.

wanobjectcache.{kClass}.{cache_action_and_result}

Upon cache access via WANObjectCache::getWithSetCallback(), this measures the total time spent in this method from start to end for all cases, except process-cache hits.

See also subsets of this measure:

  • wanobjectcache.{kClass}.regen_walltime: If regenerated, just the portion of time to regenerate the value.

  • wanobjectcache.{kClass}.regen_set_delay: If regenerated and approved for storing, the time from start to right before storing.

  • Type: Measure (in milliseconds).

  • Variable kClass: The first part of your cache key.

  • Variable result: One of:

    • "hit.good": A non-expired value was returned (and call did not get chosen for pre-emptive refresh).
    • "hit.refresh": A non-expired value was returned (and call was chosen for a pre-emptive refresh, and an async refresh was scheduled).
    • "hit.volatile": A value was found that was generated and stored less than 0.1s ago, and returned as-is despite appearing to also be expired already. This amount of time is considered negligible in terms of clock accuracy, and by random chance we usually decide to treat these as a cache hit (see RECENT_SET_HIGH_MS).
    • "hit.stale": An expired value was found, but we are within the allowed stale period specified by a lockTSE option, and the current request did not get the regeneration lock. The stale value is returned as-is.
    • "miss.compute": A new value was computed by the callback and returned. No non-expired value was found, and if this key needed a regeneration lock, we got the lock.
    • "miss.busy": A busy value was produced by a busyValue callback and returned. No non-expired value was found, and we tried to use a regeneration lock (per the busyValue option), but the current request did not get the lock.
    • "renew.compute": Artificial demand from an async refresh, led to a new value being computed by the callback. These are like "miss.compute", but in response to "hit.refresh".
    • "renew.busy": Artificial demand from an async refresh failed to produce a value. The key used the busyValue option, and could not get a regeneration lock.

wanobjectcache.{kClass}.regen_walltime

Upon cache update due to a cache miss or async refresh, this measures the time spent in the regeneration callback when computing a new value.

  • Type: Measure (in milliseconds).
  • Variable kClass: The first part of your cache key.

wanobjectcache.{kClass}.cooloff_bounce

This counter is incremented whenever a new value was computed, but not stored.

Upon a cache miss or async refresh, the WANObjectCache::getWithSetCallback() method usually recomputes the value from the callback, and sends it to a backend store.

If regenerating the value takes longer than a certain threshold of time (e.g. 50ms), then for popular keys it is likely that many web servers will generate and store the value simultaneously when the key is entirely absent from the cache. In this case, the cool-off feature can be used to protect backend stores against network congestion. This protection is implemented with a lock and subsequent cool-off period. The winner stores their value, while other web servers just return their value without storing it.

  • Type: Counter.
  • Variable kClass: The first part of your cache key.

When the regeneration callback is slow, the following scenarios may use the cool-off feature:

  • Storing the first interim value for tombstoned keys.

    If a key is currently tombstoned due to a recent delete() action, and thus in "hold-off", then the key may not be written to. A mutex lock will let one web server generate the new value and (until the hold-off is over) the generated value will be considered an interim (temporary) value only. Requests that cannot get the lock will use the last stored interim value. If there is no interim value yet, then requests that cannot get the lock may still generate their own value. Here, the cool-off feature is used to decide which requests stores their interim value.

  • Storing the first interim value for stale keys.

    If a key is currently in "hold-off" due to a recent touchCheckKey() action, then the key may not be written to. A mutex lock will let one web request generate the new value and (until the hold-off is over) such value will be considered an interim (temporary) value only. Requests that lose the lock, will instead return the last stored interim value, or (if it remained in cache) the stale value preserved from before touchCheckKey() was called. If there is no stale value and no interim value yet, then multiple requests may need to generate the value simultaneously. In this case, the cool-off feature is used to decide which requests store their interim value.

    The same logic applies when the callback passed to getWithSetCallback() in the "touchedCallback" parameter starts returning an updated timestamp due to a dependency change.

  • Storing the first value when lockTSE is used.

    When lockTSE is in use, and no stale value is found on the backend, and no busyValue callback is provided, then multiple requests may generate the value simultaneously; the cool-off is used to decide which requests store their interim value.

wanobjectcache.{kClass}.regen_set_delay

Upon cache update due to a cache miss or async refresh, this measures the time spent in WANObjectCache::getWithSetCallback(), from the start of the method to right after the new value has been computed by the callback.

This essentially measures the whole method (including retrieval of any old value, validation, any regeneration locks, and the callback), except for the time spent in sending the value to the backend store.

  • Type: Measure (in milliseconds).
  • Variable kClass: The first part of your cache key.

wanobjectcache.{kClass}.regen_set_bytes

Upon cache update due to a cache miss or async refresh, this estimates the size of a newly computed value sent to the backend store.

  • Type: Counter (in bytes).
  • Variable kClass: The first part of your cache key.

wanobjectcache.{kClass}.ck_touch.{result}

Call counter from WANObjectCache::touchCheckKey().

  • Type: Counter.
  • Variable kClass: The first part of your cache key.
  • Variable result: One of "ok" or "error".

wanobjectcache.{kClass}.ck_reset.{result}

Call counter from WANObjectCache::resetCheckKey().

  • Type: Counter.
  • Variable kClass: The first part of your cache key.
  • Variable result: One of "ok" or "error".

wanobjectcache.{kClass}.delete.{result}

Call counter from WANObjectCache::delete().

  • Type: Counter.
  • Variable kClass: The first part of your cache key.
  • Variable result: One of "ok" or "error".