github.com/hellofresh/janus@v0.0.0-20230925145208-ce8de8183c67/examples/plugin-cb/README.md (about)

     1  # Janus - Circuit Breaker Example
     2  
     3  Janus has a circuit breaker plugin that can be configured on each endpoint. To test this example start by running:
     4  
     5  ```sh
     6  docker-compose up -d
     7  ```
     8  
     9  You can access the [hystrix](https://github.com/Netflix/Hystrix) dashboard on http://localhost9002/hystrix
    10  
    11  ![](img/hystrix-home.png)
    12  
    13  On the URL field please add http://janus:8081/hystrix which is the streaming endpoint in Janus. This endpoint will start streaming metrics about your circuits.
    14  
    15  Now you can start making request to `/example`
    16  
    17  ```sh
    18  curl localhost:8080/example
    19  ```
    20  
    21  If you take a look on the dashboard you should see something like this:
    22  
    23  ![](img/hystrix-dashboard.png)
    24  
    25  ## Simulating failure
    26  
    27  To simulate failure run:
    28  
    29  ```sh
    30  docker-compose stop service1
    31  ```
    32  
    33  This will force your proxy to go down and Janus won't be able to reach it.
    34  
    35  Start making a lot of requests to `/example` and see what's going to happen on the dashboard.
    36  
    37  For all the options on how to configure this plugin please visit the [documentation](https://hellofresh.gitbooks.io/janus/plugins/cb.html) page.
    38  
    39  ## Using vegeta for failure simulation
    40  
    41  You can also use [vegeta](https://github.com/tsenart/vegeta) which is a HTTP load testing tool.
    42  
    43  Here we are going to send 10 req/s during 30s. In this time you can easily stop `service1` and see how the circuit will react.
    44  
    45  ```sh
    46  echo "GET http://localhost:8080/example" | vegeta attack -rate=10 -duration=30s | vegeta report
    47  ```