Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adaptive-accrual-failure-detector

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adaptive-accrual-failure-detector

Failure detection for processes, connections and distributed systems

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

adaptive-accrual-failure-detector

npm version

Failure detection for processes, connections and distributed systems. This is an implementation for JavaScript and TypeScript of a failure detector that uses an adaptive accrual algorithm. The theory of this detector is taken from the paper A New Adaptive Accrual Failure Detector for Dependable Distributed System authored by Benjamin Satzger, Andreas Pietzowski, Wolfang Trumler and Theo Ungerer.

This detector is useful for detecting things such as network failures between two nodes.

Usage

The failure detector is based on incoming heartbeats and has a few options that can be used when creating the detector:

  • sampleSize - number of samples kept and used when calculating probability of a failure. A higher number of samples means the probability calculation is more stable but uses more memory. Default is 1000.
  • scalingFactor - factor used to scale failure probabilities, used to reduce overestimation of failure. Default is 0.9.
  • failureThreshold - the probability needed to to detect something as a failure. If the probability of failure is above this the thing being monitored is considered failed. Default is 0.5.
// Using ES Module environment
import { FailureDetector } from 'adaptive-accrual-failure-detector';

const detector = new FailureDetector({
  failureThreshold: 0.6
});

When you receive a heartbeat you should call registerHeartbeat on the detector:

detector.registerHeartbeat();

To calculate if a failure has occurred you can call checkFailure() or calculateFailureProbability():

// Check failure, will return true if failed
const isFailed = detector.checkFailure();

// Calculate the probability of failure between 0 and 1
const failureProbability = detector.calculateFailureProbability();

Keywords

FAQs

Package last updated on 19 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc