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

airframe-control: Add CircuitBreaker #763

Merged
merged 28 commits into from
Jan 6, 2020
Merged

Conversation

xerial
Copy link
Member

@xerial xerial commented Oct 6, 2019

Implements #758

CircuitBreaker States:

  • closed
    • Requests will be processed
  • open
    • Throws an exception (fail-fast) to protect the external service
    • Wait until a given delay timeout (backoff), then move to half-open state
  • half-open
    • try to send a request
      • success: move to closed state
      • failure: move to open state

tasks

  • Integration with Retry
  • Use RetryPolicy for backoff delay
  • Add the capability to monitor the state of CircuitBreaker to know which external services were not working.
  • Integration with airframe-http-client (async based implementation) -> Added stand-alone mode to support this usage

Related work:

@xerial xerial mentioned this pull request Dec 5, 2019
76 tasks
@xerial xerial force-pushed the circuit-breaker branch 2 times, most recently from f2fcf27 to 3b7c65f Compare December 7, 2019 05:11
@codecov
Copy link

codecov bot commented Dec 17, 2019

Codecov Report

Merging #763 into master will increase coverage by 0.45%.
The diff coverage is 76.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #763      +/-   ##
==========================================
+ Coverage   81.03%   81.48%   +0.45%     
==========================================
  Files         228      237       +9     
  Lines        9004     9236     +232     
  Branches      651      668      +17     
==========================================
+ Hits         7296     7526     +230     
- Misses       1708     1710       +2
Impacted Files Coverage Δ
...src/main/scala/wvlet/airframe/control/Ticker.scala 0% <ø> (ø) ⬆️
...a/wvlet/airframe/sql/analyzer/QuerySignature.scala 77.77% <ø> (ø) ⬆️
...wvlet/airframe/sql/analyzer/InOutTableFinder.scala 95.45% <ø> (ø) ⬆️
.../wvlet/airframe/sql/model/LogicalPlanPrinter.scala 100% <100%> (ø) ⬆️
...la/wvlet/airframe/sql/analyzer/SQLAnonymizer.scala 75% <100%> (+0.71%) ⬆️
...rframe/control/util/ExponentialMovingAverage.scala 100% <100%> (ø)
...ala/wvlet/airframe/jdbc/SQLiteConnectionPool.scala 92.3% <100%> (ø) ⬆️
...la/wvlet/airframe/jdbc/ConnectionPoolFactory.scala 100% <100%> (ø)
...rc/main/scala/wvlet/airframe/control/Control.scala 100% <100%> (ø) ⬆️
...scala/wvlet/airframe/sql/parser/SQLGenerator.scala 87.5% <50%> (ø) ⬆️
... and 28 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2884eea...7ab047c. Read the comment docs.

@xerial xerial changed the title [WIP] airframe-control: Add CircuitBreaker airframe-control: Add CircuitBreaker Jan 1, 2020
@xerial xerial requested a review from takezoe January 1, 2020 07:49
@xerial
Copy link
Member Author

xerial commented Jan 1, 2020

@takezoe I think this supports the basic functionality of circuit breaker that can be configured to our use case.

@xerial xerial added this to the Airframe 20 milestone Jan 2, 2020
@xerial
Copy link
Member Author

xerial commented Jan 6, 2020

@takezoe I think creating a snapshot version of this CircuitBreaker is better for testing this. So let me merge it and fix the implementation as we find ideas for improving the design.

@xerial xerial merged commit e55521b into wvlet:master Jan 6, 2020
@xerial xerial deleted the circuit-breaker branch January 6, 2020 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant