Twelve-factor apps make a strong case for designing and implementing your microservices for failure. What that means is with the proliferation of microservices, failure is inevitable, and applications should be fault-tolerant. Istio, a service mesh, can help make your microservices resilient without changing application code.
Building and packaging microservices is one part of the story. Given that a highly salable and distributed microservices deployment is going to face failures at different layers, how do we make these microservices resilient and fault-tolerant? How do we enforce policy decisions, such as fine-grained access control and rate limits? How do we enable timeouts/retries, health checks, etc.? Even though some language-specific frameworks address these issues, the implementation is often framework- or language-specific. If the underlying framework or language changes, the resiliency features need to be reimplemented or ported over. And in some cases, applications also have the responsibility of implementing the code and configuration required for resiliency and fault-tolerance. A service-mesh architecture attempts to resolve these issues by extracting the common resiliency features needed by a microservices framework away from the applications and frameworks and into the platform itself. Istio provides an easy way to create this service mesh. In this developer journey, we demonstrate how to build, deploy, and connect your Java™ MicroProfile microservices, leveraging Istio service mesh. We then show how to configure and use circuit breakers, timeouts/retries, rate limits, and other advanced resiliency features from Istio without changing the application code.
- Deploy a Java application that is configured to run in a Kubernetes Cluster.
- Inject Istio envoys on the application.
- Configure advanced Istio features for the MicroProfile and create a circuit breaker for the Cloudant database.
- Create a load-balancing pool with two instances of Cloudant, then use a circuit breaker to detect and eject an instance when no longer healthy.
- Create a timeout and retry rule for the Vote microservice connection to Cloudant.
- Get and build the application code.
- Deploy application microservices and Istio envoys.
- Explore Istio resiliency features: Circuit Breakers and Fault Injection.