chapter six

6 Resilient Communication

 

This chapter covers

  • Tips and tricks for how to use retry and timeout for gRPC communication
  • Using circuit breaker for inter-service communication to have better resiliency
  • Error handling during service communications
  • Securing inter-service communication with TLS Configuration

In a typical Monolithic application, any critical error can bring the entire system down since all the components of application lives in one shared runtime. Once you switch to microservice architecture, those components will be decoupled by extracting to separate services, but still this distributed system environment has its own disadvantages. For this reason, microservices should be designed for resiliency and they should be always fault tolerant. Let’s look at what are the problematic use-cases that you can see 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

6.4 Summary