How to build resilient microservices

Resilient microservices require resilient interservice communications. These patterns and Ballerina can help

Increasingly, developers rely on a microservices architecture to build an application as a suite of fine-grained, narrowly focused, and independent services, each of which is developed and deployed independently. Despite the agility fostered by the microservices approach, it also brings new challenges, since these services have to interact with each other and with other systems, such as web APIs and databases, via network calls. And because the network is always an unreliable factor, such interactions are susceptible to failure at any time.

Therefore, the resiliency of a microservices-based application—i.e., the ability to recover from certain types of failure and remain functional—heavily depends on how well the app handles inter-service communication over an unreliable network. For this reason, the resiliency of a microservices based-application depends just as heavily on how resiliently you implement microservices communications.

Given the sheer proliferation of microservices, building microservices communications over the network is becoming one of the hardest aspects of realizing a microservices architecture. At the same time, numerous resiliency patterns have emerged to address this challenge. These include timeout, retry, circuit breaker, fail-fast, bulkhead, transactions, load balancing, failover, and guaranteed delivery.

Let’s look at the commonly used microservices resiliency patterns. Then we’ll examine how these patterns can be applied using Ballerina, an emerging open source programming language that is optimized for integration and designed for building microservices and cloud-native applications. Finally, we will discuss the role of service meshes in offloading inter-service communication functions.

To continue reading this article register now