记Hystrix断路器官方文档

记Hystrix断路器官方文档

断路器CircuitBreaker执行流程

  1. 请求来临时,判断是否允许请求:通过判断成功和失败次数的比率与设置的threshold对比,如果大于那个值,就打开断路器。
  2. 当短路器打开以后,这个服务将不会提供服务,知道sleep时间到了,到了之后,开始允许一部分请求访问(实验性访问),此时为看开状态。如果访问通过,则关闭断路器,同时清空线程池;若访问没有成功,则进入closed state。

Isolation

Hystrix employs the bulkhead pattern to isolate dependencies from each other and to limit concurrent access to any one of them.

Hystrix采用舱壁模式(bulkhead pattern)将依赖关系彼此隔离,并限制对其中的任何一个的并发访问。

舱壁模式示意图

Clients (libraries, network calls, etc) execute on separate threads. This isolates them from the calling thread (Tomcat thread pool) so that the caller may “walk away” from a dependency call that is taking too long.

客户端(库,网络调用等)在单独的线程上执行。

这样可以将它们与调用线程(Tomcat线程池)隔离,以便调用者可以“摆脱”花费太长时间的依赖项调用。

posted @ 2020-11-28 21:04  小桃无主花自开  阅读(100)  评论(0编辑  收藏  举报