public class PhiAccrualFailureDetector extends Object implements FailureDetector
Implementation of 'The Phi Accrual Failure Detector' by Hayashibara et al. as defined in their paper.
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:
where F is the cumulative distribution function of a normal distribution with mean
and standard deviation estimated from historical heartbeat inter-arrival times.
φ = -log10(1 - F(timeSinceLastHeartbeat)
Constructor and Description |
---|
PhiAccrualFailureDetector(double threshold,
int maxSampleSize,
double minStdDeviationMillis,
long acceptableHeartbeatPauseMillis,
long firstHeartbeatEstimateMillis) |
Modifier and Type | Method and Description |
---|---|
void |
heartbeat(long timestampMillis)
Notifies this failure detector about received heartbeat message from the tracked member.
|
boolean |
isAlive(long timestampMillis)
Returns true if the tracked member is considered as alive/available.
|
long |
lastHeartbeat()
Returns the last heartbeat timestamp for the tracked member.
|
double |
suspicionLevel(long timestamp)
Returns suspicion level about the tracked member.
|
public PhiAccrualFailureDetector(double threshold, int maxSampleSize, double minStdDeviationMillis, long acceptableHeartbeatPauseMillis, long firstHeartbeatEstimateMillis)
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 crashesmaxSampleSize
- Number of samples to use for calculation of mean and standard deviation of
inter-arrival times.minStdDeviationMillis
- 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.acceptableHeartbeatPauseMillis
- 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.firstHeartbeatEstimateMillis
- Bootstrap the stats with heartbeats that corresponds to this duration,
with a with rather high standard deviation (since environment is unknown
in the beginning)public boolean isAlive(long timestampMillis)
FailureDetector
isAlive
in interface FailureDetector
timestampMillis
- timestamp in millisecondspublic void heartbeat(long timestampMillis)
FailureDetector
heartbeat
in interface FailureDetector
timestampMillis
- timestamp of heartbeat message in millisecondspublic long lastHeartbeat()
FailureDetector
lastHeartbeat
in interface FailureDetector
public double suspicionLevel(long timestamp)
FailureDetector
0
indicates no suspicion at all.suspicionLevel
in interface FailureDetector
timestamp
- timestamp in millisecondsCopyright © 2022 Hazelcast, Inc.. All Rights Reserved.