Chapter 10. Fronting services: Circuit breakers and API gateways


This chapter covers

  • The service side of an interaction between two microservices
  • Circuit breakers
  • API gateways
  • Sidecars and service mesh

I began talking about interactions between services in chapter 8, with a focus on dynamic routing and service discovery; I was talking about how clients can find and access a service they depend on. After the client finds and addresses the needed service, it initiates an interaction. The previous chapter and this one come together to consider both sides of that interaction—as shown in figure 10.1. In chapter 9, I talked about the resilience of this interaction; I was largely talking about request redundancy, something the client is responsible for and applies controls to. Now I want to turn to the service side of that client/service interaction and the essential design patterns that play a role here.

Figure 10.1. Just as the client can and should implement certain patterns to act as a good participant in the interaction, so too should the service. These are the patterns covered in this chapter.

As the developer of the service, you have to account for many interaction-related concerns:

10.1. Circuit breakers

10.2. API gateways

10.3. The service mesh