PhiAccrualFailureDetector

org.apache.pekko.remote.PhiAccrualFailureDetector
class PhiAccrualFailureDetector(val threshold: Double, val maxSampleSize: Int, val minStdDeviation: FiniteDuration, val acceptableHeartbeatPause: FiniteDuration, val firstHeartbeatEstimate: FiniteDuration, eventStream: Option[EventStream])(implicit clock: Clock) extends FailureDetector, FailureDetectorWithAddress

Implementation of 'The Phi Accrual Failure Detector' by Hayashibara et al. as defined in their paper: [https://oneofus.la/have-emacs-will-hack/files/HDY04.pdf]

The suspicion level of failure is given by a value called φ (phi). The basic idea of the φ failure detector is to express the value of φ on a scale that is dynamically adjusted to reflect current network conditions. A configurable threshold is used to decide if φ is considered to be a failure.

The value of φ is calculated as:

φ = -log10(1 - F(timeSinceLastHeartbeat)

where F is the cumulative distribution function of a normal distribution with mean and standard deviation estimated from historical heartbeat inter-arrival times.

Value parameters

acceptableHeartbeatPause

Duration corresponding to number of potentially lost/delayed heartbeats that will be accepted before considering it to be an anomaly. This margin is important to be able to survive sudden, occasional, pauses in heartbeat arrivals, due to for example garbage collect or network drop.

clock

The clock, returning current time in milliseconds, but can be faked for testing purposes. It is only used for measuring intervals (duration).

firstHeartbeatEstimate

Bootstrap the stats with heartbeats that corresponds to to this duration, with a with rather high standard deviation (since environment is unknown in the beginning)

maxSampleSize

Number of samples to use for calculation of mean and standard deviation of inter-arrival times.

minStdDeviation

Minimum standard deviation to use for the normal distribution used when calculating phi. Too low standard deviation might result in too much sensitivity for sudden, but normal, deviations in heartbeat inter arrival times.

threshold

A low threshold is prone to generate many wrong suspicions but ensures a quick detection in the event of a real crash. Conversely, a high threshold generates fewer mistakes but needs more time to detect actual crashes

Attributes

Source
PhiAccrualFailureDetector.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(threshold: Double, maxSampleSize: Int, minStdDeviation: FiniteDuration, acceptableHeartbeatPause: FiniteDuration, firstHeartbeatEstimate: FiniteDuration)(implicit clock: Clock)

Constructor without eventStream to support backwards compatibility

Constructor without eventStream to support backwards compatibility

Attributes

Source
PhiAccrualFailureDetector.scala
def this(config: Config, ev: EventStream)

Constructor that reads parameters from config. Expecting config properties named threshold, max-sample-size, min-std-deviation, acceptable-heartbeat-pause and heartbeat-interval.

Constructor that reads parameters from config. Expecting config properties named threshold, max-sample-size, min-std-deviation, acceptable-heartbeat-pause and heartbeat-interval.

Attributes

Source
PhiAccrualFailureDetector.scala

Concrete methods

final override def heartbeat(): Unit

Notifies the FailureDetector that a heartbeat arrived from the monitored resource. This causes the FailureDetector to update its state.

Notifies the FailureDetector that a heartbeat arrived from the monitored resource. This causes the FailureDetector to update its state.

Attributes

Definition Classes
Source
PhiAccrualFailureDetector.scala
override def isAvailable: Boolean

Returns true if the resource is considered to be up and healthy and returns false otherwise.

Returns true if the resource is considered to be up and healthy and returns false otherwise.

Attributes

Definition Classes
Source
PhiAccrualFailureDetector.scala
override def isMonitoring: Boolean

Returns true if the failure detector has received any heartbeats and started monitoring of the resource.

Returns true if the failure detector has received any heartbeats and started monitoring of the resource.

Attributes

Definition Classes
Source
PhiAccrualFailureDetector.scala
def phi: Double

The suspicion level of the accrual failure detector.

The suspicion level of the accrual failure detector.

If a connection does not have any records in failure detector then it is considered healthy.

Attributes

Source
PhiAccrualFailureDetector.scala
protected def recordInterval(interval: Long): HeartbeatHistory
def setAddress(addr: String): Unit

Address of observed host will be set after detector creation.

Address of observed host will be set after detector creation.

Attributes

Source
PhiAccrualFailureDetector.scala