Grpc-java: gRPC - Circuit Breaker recommendations

Created on 3 Aug 2020  ·  5Comments  ·  Source: grpc/grpc-java


hi Team,

We are currently building a service that uses grpc as transport protocol.
As part of it we are planning to have a circuit breaker for grpc client
we would like to know if there are any recommendations around building/using circuit breaker library/framework that can be consumed by grpc client?

question

Most helpful comment

Hi, if you're open to using an alternative Java client, Armeria supports circuit breakers with grpc. See https://armeria.dev/docs/client-circuit-breaker for an example.

I believe it can also be used in a framework agnostic way, but we use the Armeria client directly.

All 5 comments

Hi, if you're open to using an alternative Java client, Armeria supports circuit breakers with grpc. See https://armeria.dev/docs/client-circuit-breaker for an example.

I believe it can also be used in a framework agnostic way, but we use the Armeria client directly.

A circuit breaker in gRPC would just be a client interceptor (and potentially a server interceptor, depending on how the breaking is designed).

I think there are various implementations scattered about. https://github.com/alibaba/Sentinel looks like it has one with interceptors, just as an example.

Can Hystrix/Resilience4j be integrated with grpc client for circuit breaker capabilities?

I don't think we have the expertise to really answer your question. But just taking a cursory glance does provide the "flavor" of what the solutions may look like.

A quick look at Hystrix makes it seem like it is applied "on top" of an API: "Wrapping all calls to external systems (or “dependencies”) in a HystrixCommand." So it would work for anything. But you are calling Hystrix directly at each callsite.

A quick Google search for Resilience4j make it look fairly trivial to integrate as an interceptor: https://gist.github.com/eungju/226274b3dacb3203de3514bcf1c54505

Seems this is answered as best as we can, so closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nddipiazza picture nddipiazza  ·  3Comments

NomadXD picture NomadXD  ·  3Comments

JBayangosB picture JBayangosB  ·  3Comments

nmittler picture nmittler  ·  4Comments

njovy picture njovy  ·  5Comments