Build fault-tolerant microservices
Deploy an Open Liberty application using Eclipse MicroProfile on Kubernetes
This developer code pattern demonstrates the deployment of a Open Liberty application using Eclipse MicroProfile on Kubernetes. It uses Prometheus to scrape application metrics and the Grafana platform for analytics and monitoring. The application uses MicroProfile Release 2.1 and focuses on fault-tolerance, which is one of the features in that release.
All microservices fail, and it’s is important to create resilient microservices. Eclipse MicroProfile Fault Tolerance provides a simple, configurable, and flexible solution to create a fault-tolerant microservice. It offers the following fault-tolerance policies:
- Timeout: Define a duration for timeout.
- Retry: Define a criteria on when to retry.
- Fallback: Provides an alternative solution for a failed execution.
- Bulkhead: Isolates failures in part of the system while the rest of the system can still function.
- CircuitBreaker: Offers a way of fast-fail by automatically failing execution to prevent the system overloading and indefinite wait or timeout by the clients.
- Asynchronous: Invoke the operation asynchronously.
The main design is to separate execution logic from execution. The execution can be configured with fault-tolerance policies.
MicroProfile is a baseline platform definition that optimizes Enterprise Java for a microservices architecture and delivers application portability across multiple MicroProfile runtimes. Since the release of MicroProfile 1.2, the metrics feature comes out of the box with the platform.
The sample application used is a web application for managing a conference and is based on a number of discrete microservices. The front end is written in Angular; the backing microservices are in Java. All run on Open Liberty, in Docker containers managed by Kubernetes. It’s based on a demo application from the MicroProfile platform team. The fork sample application was converted to use Open Liberty and Microprofile Metrics, which is part of Microprofile Release 2.1.
- Create Kubernetes service in IBM Cloud.
- Deploy all the microservices into the Kubernetes cluster.
- Deploy Prometheus server as a service into the Kubernetes cluster.
- Deploy Grafana as a service into the Kubernetes cluster.
- Use Ingress gateway to expose the web application from the Kubernetes cluster.
- User accesses the web application through browser.
Ready to get started? See the README for step-by-step instructions.