Chapter 7. Traffic Management

Cloud native applications expect failure and low availability from the other services and resources they interact with. In this chapter, we introduce important mitigation strategies involving load balancing (platform, gateway, and client-side) and call resilience patterns (retrying, rate limiters, bulkheads, and circuit breakers) that work together to ensure your microservices continue to perform.

These patterns won’t be applicable for every organization. Often introducing more complex traffic management trades off operational complexity for more predictable user experience or a lower overall failure rate. In other words, it’s easy to make a REST call to a downstream service with your HTTP client of choice; it’s a little more complicated to wrap that call in a retry. And a little more complicated still to provide a circuit breaker and fallback. But with greater complexity comes greater reliability.

Organizations should evaluate their need here based on the types of applications they have (for example, where circuit breaking is applicable) and which application frameworks microservices are primarily written in. Java has first-class library support for these patterns and integration into popular frameworks like Spring, but the lack of support in some other languages would make it preferable to use sidecars or service meshes, even if there is some loss of flexibility as a result.

Microservices Offer More Potential Failure Points

As the number of microservices ...

Get SRE with Java Microservices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.