6 Resilient communication

 

This chapter covers

  • Tips and tricks for how to use retry and timeout for gRPC communication
  • Using circuit breakers for interservice communication to have better resiliency
  • Error handling during service communications
  • Securing interservice communication with TLS configuration

In a typical monolithic application, any critical error can bring the entire system down because all the application components live in one shared runtime. Once you switch to microservice architecture, those components are decoupled by extracting to separate services, but this distributed system environment has its own disadvantages. For this reason, microservices should be designed for resiliency and always be fault tolerant. Let’s look at the problematic use cases in a microservices environment first, then explain the possible solutions to make microservices resilient and fault tolerant.

6.1 Resiliency patterns

6.1.1 Timeout pattern

6.1.2 Retry pattern

6.1.3 Circuit breaker pattern

6.2 Error handling

6.2.1 gRPC error model

6.2.2 gRPC error response

6.3 Securing gRPC communication

6.3.1 TLS handshake

6.3.2 Certificate generation

6.3.3 gRPC TLS credentials