Show / Hide Table of Contents

Class PhiAccrualFailureDetector

Represents Phi Accrual implementation of the failure detector.

Inheritance
object
PhiAccrualFailureDetector
Implements
IFailureDetector
IResettable
ISupplier<double>
IFunctional<Func<double>>
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.Diagnostics
Assembly: DotNext.Net.Cluster.dll
Syntax
public class PhiAccrualFailureDetector : IFailureDetector, IResettable, ISupplier<double>, IFunctional<Func<double>>

Constructors

| Edit this page View Source

PhiAccrualFailureDetector(TimeSpan)

Initializes a new failure detector.

Declaration
public PhiAccrualFailureDetector(TimeSpan estimatedFirstHeartbeat)
Parameters
Type Name Description
TimeSpan estimatedFirstHeartbeat

The estimated interval to the first heartbeat.

Exceptions
Type Condition
ArgumentOutOfRangeException

estimatedFirstHeartbeat is less than or equal to Zero.

Properties

| Edit this page View Source

AcceptableHeartbeatPause

Gets or sets duration corresponding to number of potentially lost/delayed heartbeats that will be accepted before considering it to be an anomaly.

Declaration
public TimeSpan AcceptableHeartbeatPause { get; init; }
Property Value
Type Description
TimeSpan
Remarks

Too low standard deviation might result in too much sensitivity for sudden, but normal, deviations in heartbeat inter arrival times.

| Edit this page View Source

IsHealthy

Indicates that the resource associated with this detector is considered to be up and healthy.

Declaration
public bool IsHealthy { get; }
Property Value
Type Description
bool
| Edit this page View Source

IsMonitoring

Indicates that this detector has received any heartbeats and started monitoring of the resource.

Declaration
public bool IsMonitoring { get; }
Property Value
Type Description
bool
| Edit this page View Source

MaxSampleSize

Gets or sets a number of samples to use for calculation of mean and standard deviation of inter-arrival times.

Declaration
public int MaxSampleSize { get; init; }
Property Value
Type Description
int
| Edit this page View Source

MinStdDeviation

Gets or sets minimum standard deviation to use for the normal distribution used when calculating phi.

Declaration
public TimeSpan MinStdDeviation { get; init; }
Property Value
Type Description
TimeSpan
Remarks

Too low standard deviation might result in too much sensitivity for sudden, but normal, deviations in heartbeat inter-arrival times.

| Edit this page View Source

Threshold

Gets or sets Phi value threshold that is used to determine whether the underlying resource is no longer available.

Declaration
public double Threshold { get; init; }
Property Value
Type Description
double
Remarks

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.

Exceptions
Type Condition
ArgumentNullException

value is less than or equal to 0.

| Edit this page View Source

TreatUnknownValueAsUnhealthy

Gets or sets a value indicating that this detector interprets false value of IsMonitoring as unhealthy resource.

Declaration
public bool TreatUnknownValueAsUnhealthy { get; init; }
Property Value
Type Description
bool
Remarks

By default, this property is false.

| Edit this page View Source

Value

Gets Phi value.

Declaration
public double Value { get; }
Property Value
Type Description
double

Methods

| Edit this page View Source

GetValue(Timestamp)

Gets Phi value.

Declaration
public double GetValue(Timestamp ts)
Parameters
Type Name Description
Timestamp ts

The timestamp of the heartbeat.

Returns
Type Description
double

Phi value.

| Edit this page View Source

ReportHeartbeat()

Notifies that this detector received a heartbeat from the associated resource.

Declaration
public void ReportHeartbeat()
| Edit this page View Source

ReportHeartbeat(Timestamp)

Notifies that this detector received a heartbeat from the associated resource.

Declaration
public void ReportHeartbeat(Timestamp ts)
Parameters
Type Name Description
Timestamp ts

The timestamp of the heartbeat.

| Edit this page View Source

Reset()

Resets this detector to its initial state.

Declaration
public void Reset()

Events

| Edit this page View Source

SuspiciousIntervalGrowth

An event occurred when this detector considers than the interval between two heartbeats is growing too fast.

Declaration
public event Action<TimeSpan> SuspiciousIntervalGrowth
Event Type
Type Description
Action<TimeSpan>

Implements

IFailureDetector
IResettable
ISupplier<TResult>
IFunctional<TDelegate>

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)

See Also

The Phi Accrual Failure Detector
Implementation in Scala
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾