Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add information about the opening strategies for Circuit Breaker #134

Merged
merged 3 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions content/docs/learn/resilience/circuitbreaker.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ in _Cloud Design Patterns_.

:::

## Opening strategies

Arrow offers different strategies to determine when the circuit breaker should open and short-circuit all incoming requests. The currently available ones are:

- [_Count_](https://arrow-kt.github.io/arrow/arrow-resilience/arrow.resilience/-circuit-breaker/-opening-strategy/-count/index.html).
This strategy sets a maximum number of failures. Once this threshold is reached, the circuit breaker moves to _Open_.
Note that every time a request succeeds, the counter is set back to zero; the circuit breaker only
moves to _Open_ when the maximum number of failures happen **consecutively**.
- [_Sliding Window_](https://arrow-kt.github.io/arrow/arrow-resilience/arrow.resilience/-circuit-breaker/-opening-strategy/-sliding-window/index.html).
This strategy counts the number of failures within a given time window. Unlike the `Count` approach, the circuit breaker
will only move to `Open` if the number of failing requests tracked within the given period exceeds the threshold. As the
time window slides, the failures out of the window limits are ignored.

## Arrow's [`CircuitBreaker`](https://arrow-kt.github.io/arrow/arrow-resilience/arrow.resilience/-circuit-breaker/index.html)

Let's create a circuit breaker that only allows us to call a remote service twice.
Expand Down
2 changes: 1 addition & 1 deletion content/docs/learn/resilience/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ even though a migration window is in place until Arrow 2.0.

:::

The Arrow Fx Resilience library implements three of the most critical design
The Arrow Resilience library implements three of the most critical design
pattern around resilience:

- Retry and repeat computations using [`Schedule`](../retry-and-repeat),
Expand Down
2 changes: 1 addition & 1 deletion content/docs/learn/resilience/saga.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ in _Cloud Design Patterns_.
import io.kotest.matchers.shouldBe
-->

Arrow Fx Resilience provides the [`saga`](https://arrow-kt.github.io/arrow/arrow-resilience/arrow.resilience/saga.html)
Arrow Resilience provides the [`saga`](https://arrow-kt.github.io/arrow/arrow-resilience/arrow.resilience/saga.html)
function, which creates a new scope where compensating actions can be declared
alongside the action to perform. This is done by the [`saga` function in
`SagaScope`](https://arrow-kt.github.io/arrow/arrow-resilience/arrow.resilience/-saga-scope/saga.html).
Expand Down