Skip to content

alistairstead/breaker-breaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

breaker-breaker NPM version Build Status Dependency Status Coverage percentage js-standard-style

Circuit-breaker solution using Proxy to allow all object methods to be wrapped with the breaker pattern

Install

$ npm install --save breaker-breaker

Usage

var Breaker = require('breaker-breaker');
let request = Breaker.create(require('request'), 'request::npm.org', {
  invocation_timeout: 1000
});

request.get('http://www.npm.org', function (err, response) {
  if (err) {
    // handle the error
  }

  // use the response
});

What Design Principles Underlie breaker-breaker?

breaker-breaker works by:

  • Preventing any single dependency from blocking the event loop or delaying callback and promise chains.
  • Shedding load and failing fast instead of queueing.
  • The fail fast option halts the execution of the long running call to the external dependency.
  • Leaves fallback functionality to the consuming application; error callback, promise reject or event observers within the consumer should manage the fallback functionality.

Using isolation techniques (such as bulkhead, swimlane, and circuit breaker patterns) to limit the impact of any one dependency. Optimizing for time-to-discovery through near real-time metrics, monitoring, and alerting Optimizing for time-to-recovery by means of low latency propagation of configuration changes and support for dynamic property changes in most aspects of Hystrix, which allows you to make real-time operational modifications with low latency feedback loops. Protecting against failures in the entire dependency client execution, not just in the network traffic.

Known Issues

  • This can trigger a V8 bug with 'illegal access' errors being thrown see: expressjs/express#2652 Using iojs-v3.0.0 resolves this non user space error.

License

Apache-2.0 © Alistair Stead

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published