failure

package module
v0.0.0-...-a8ded3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2022 License: MIT Imports: 10 Imported by: 0

README

Phi-Accrual Failure Detection

Implementation of a phi-accrual failure detector from Hayashibara et al..

Example

Example (see: ./example/ )implements a lookaside-load-balancer using a phi-accrual failure detector to serve healthy node addresses.

Paper

@article{article,
	author = {Hayashibara, Naohiro and Défago, Xavier and Yared, Rami and Katayama, Takuya},
	year = {2004},
	month = {01},
	pages = {},
	title = {The φ accrual failure detector},
	doi = {10.1109/RELDIS.2004.1353004}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntervalStatistics

type IntervalStatistics struct {
	// contains filtered or unexported fields
}

IntervalStatistics - collection of stats for calculating phi (phi-accrual only, others tbd)

func (*IntervalStatistics) Phi

func (s *IntervalStatistics) Phi(lastT time.Time, currentT time.Time) float64

Phi - calculate phi (suspicion level) from IntervalStatistics

type Node

type Node struct {
	RecentClients map[string]*PhiAccrualDetector // maps senderAddress -> detector
	// contains filtered or unexported fields
}

Node - collection of health detectors for each client sending through the interceptor

func NewFailureDetectorNode

func NewFailureDetectorNode(nOpts *NodeOptions, nMetadata *NodeMetadata) *Node

NewFailureDetectorNode - new failure-detecting node

func (*Node) FailureDetectorInterceptor

func (n *Node) FailureDetectorInterceptor() grpc.UnaryServerInterceptor

FailureDetectorInterceptor - Acts as a UnaryServerInterceptor, updates detector node's heartbeat statistics when sees an incoming failproto.Beat message

func (*Node) PurgeInactiveClients

func (n *Node) PurgeInactiveClients(ctx context.Context, calcTimestamp time.Time)

PurgeNeighbors - calculates phi and removes processes that have been marked suspicious (using +inf as suspicion threshold) AND have not been seen within grace period.

func (*Node) ReceiveHeartbeat

func (n *Node) ReceiveHeartbeat(ctx context.Context, clientID string, beatmsg *failproto.Beat) error

ReceiveHeartbeat - create or update a record in the node's RecentClients

func (*Node) WatchConnectedNodes

func (n *Node) WatchConnectedNodes(ctx context.Context)

WatchConnectedNodes - watches all connected clients, if the reap interval

type NodeMetadata

type NodeMetadata struct {
	HostAddress string
	AppID       string
}

NodeMetadata - metadata abt. the running grpc application for labeling published metrics

type NodeOptions

type NodeOptions struct {
	EstimationWindowSize int
	ReapInterval         time.Duration
	PurgeGracePeriod     time.Duration
}

NodeOptions - options for distribution estimation window, purging interval, etc.

type PhiAccrualDetector

type PhiAccrualDetector struct {
	// contains filtered or unexported fields
}

PhiAccrualDetector - detector for each client pinging the server

func NewPhiAccrualDetector

func NewPhiAccrualDetector(hbTime time.Time, nOpts *NodeOptions, metadata *NodeMetadata) *PhiAccrualDetector

NewPhiAccrualDetector -

func (*PhiAccrualDetector) AddValue

func (phiD *PhiAccrualDetector) AddValue(ctx context.Context, arrivalTime time.Time) error

AddValue - tack on a value to the statistics

func (*PhiAccrualDetector) Suspicion

func (phiD *PhiAccrualDetector) Suspicion(ctime time.Time) float64

Suspicion - calculates suspicion given the current detector state and a given time

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL