Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Circuit Breaker and Hystrix

Circuit Breaker and Hystrix

Avatar for Victor Bogo

Victor Bogo

October 29, 2019
Tweet

More Decks by Victor Bogo

Other Decks in Programming

Transcript

  1. The problem monolith ms a • http worker pool •

    datasource connection pool • x thread pool • http worker pool • datasource connection pool • x thread pool
  2. The problem http worker 1 datasource conn 1 http worker

    2 datasource conn 2 9 datasource conn available 9 http workers available
  3. The problem http worker 1 datasource conn 1 http worker

    2 datasource conn 2 Δ 10ms = 2 http workers 2 datasource connections in use for 10ms 9 http workers available 9 datasource conn available
  4. The problem http worker 1 datasource conn 1 http worker

    2 datasource conn 2 Δ 1000ms = 2 http workers 2 datasource connections in use for 1000ms 9 http workers available 9 datasource conn available
  5. The problem http worker 1..10 datasource conn 1..10 http worker

    2..n datasource conn 2..n Δ 1000ms = 20 http workers 20 datasource connections in use for 1000ms 0 http workers available 0 datasource conn available What if we receive 10 requests like this one? HTTP 503 SERVICE UNAVAILABLE
  6. The problem monolith external service (e.g SEFAZ) ms a ms

    b ms n req 1 req 1 req 1 req 2 open circuit
  7. Resources Hystrix Wiki: https://github.com/Netflix/Hystrix/wiki Martin Fowler on Circuit Breakers: https://martinfowler.com/bliki/CircuitBreaker.html

    Fault tolerance in a HV Distributed System by Netflix: https://medium.com/netflix- techblog/fault-tolerance-in-a-high-volume-distributed-system-91ab4faae74a Making the Netflix API More Resilient: https://medium.com/netflix-techblog/making-the- netflix-api-more-resilient-a8ec62159c2d Release it! Book by Michael Nygard: https://www.amazon.com/Release-Production- Ready-Software-Pragmatic-Programmers/dp/0978739213
  8. Q?