📗
Janus Manual
  • Introduction
  • Installation
    • Docker
  • Quick Start
    • Authenticating
    • Add an endpoint
    • Modify (Update/Delete) an endpoint
    • Add Plugins
    • Authentication
    • Adding your API - File System
  • Clustering/HA
  • Proxy Reference
    • Terminology
    • Overview
    • Routing capabilities
    • Load Balacing
    • Request Host header
      • Using wildcard hostnames
      • The preserve_host property
    • Request URI
      • The strip_path property
      • The append_path property
    • Request HTTP method
    • Routing priorities
    • Conclusion
  • Plugins
    • Basic
    • Organization
    • Body Limit
    • Circuit Breaker
    • Compression
    • CORS
    • OAuth
    • Rate Limit
    • Request Transformer
    • Response Transformer
    • Retry
  • Auth
    • OAuth 2.0
  • Misc
    • Health Checks
    • Monitoring
    • Tracing
  • Known Issues
    • Stale HTTP Keep-Alive
  • Upgrade Notes
    • 2.x to 3.x
    • 3.6.x to 3.7.x
Powered by GitBook
On this page

Was this helpful?

  1. Plugins

Circuit Breaker

PreviousBody LimitNextCompression

Last updated 4 years ago

Was this helpful?

Janus has a circuit breaker plugin that can be configured for each endpoint. You can check our on how to use the plugin.

Configuration

The plain cb config:

{
    "name" : "cb",
    "enabled" : true,
    "config" : {
        "name": "my-circuit-breaker",
        "timeout" : 1000,
        "max_concurrent_requests": 100,
        "error_percent_threshold": 50,
        "request_volume_threshold": 20,
        "sleep_window": 5000,
        "predicate": "statusCode == 0 || statusCode >= 500"
    }
}

Configuration

Description

name

Circuit Breaker name to group stats

timeout

Timeout that the CB will wait till the request responds

max_concurrent_requests

How many commands of the same type can run at the same time

error_percent_threshold

Causes circuits to open once the rolling measure of errors exceeds this percent of requests

request_volume_threshold

Is the minimum number of requests needed before a circuit can be tripped due to health

sleep_window

Is how long, in milliseconds, to wait after a circuit opens before testing for recovery

predicate

The rule that we will check to define if the request was successful or not. You have access to statusCode and all the request object. Defaults to statusCode == 0 \|\| statusCode >= 500

example