断路器模式是否也适用于异步请求? [英] Is circuit breaker pattern applicable for asynchronous requests also?
问题描述
我是 微服务
架构的新手.我发现了很多在同步
请求中实现断路器的例子.
I am new to microservice
architecture. I found lots of examples to implement circuit breakers in synchronous
requests.
但是我们在异步
请求流中是否也需要断路器
?
But do we need circuit breakers
in asynchronous
request flows also?
推荐答案
断路器模式主要适用于同步服务通信.这是为了避免服务因请求而变得不堪重负,并且客户端开始重试请求,从而使情况变得更糟.
The Circuit Breaker Pattern is mostly applicable for synchronous service communication. It is meant to avoid that a service is becoming overwhelmed with requests, and that the clients start to retry the requests so that the situation gets even worse.
在异步、事件驱动的架构中,服务将事件放在代理上,消费者按自己的节奏读取事件 - 因此生产者和消费者解耦所以它不存在与服务之间的同步通信相同的问题.
In an asynchronous, event-driven architecture, services put events on a broker, and consumers reads events in its own pace - so the producer and the consumer is decoupled so it does not have the same problem as with synchronous communication between services.
这篇关于断路器模式是否也适用于异步请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!