Community Blog Introduction to a Java Fault Tolerance Library: Resilience4j

Introduction to a Java Fault Tolerance Library: Resilience4j

In this article, we will introduce Resilience4j, which contributes to the promotion of "fault tolerance" for Java microservices, and some resources for the development of microservices.

Resilience4j is a lightweight fault tolerance library inspired by Netflix Hystrix and designed for Java 8 and functional programming. The library is lightweight, because it only uses Vavr (formerly known as Javaslang) and has no other external library dependencies.

In 2012, Netflix opened Hystrix, the fault tolerance library. Hystrix contributes to the promotion of the concept of "fault tolerance" for microservices, and spreads the concept of isolation and tolerance to a wide range of developers. For a long time, whenever it comes to isolation and fault tolerance, developers first think of Hystrix. By 2014, Netflix had a full march into Spring Cloud, and a series of Netflix' microservice components also came into the developers' view along with Spring Cloud Netflix. At the same time, Hystrix made a major refactoring of the underlying statistical structure by using RxJava, fully embracing RxJava. Hystrix has long been a popular fault tolerance library across the industry, but the community activity has been declining. Recently, Hystrix suddenly came to a screeching halt and announced to stop maintenance. But Reverence4j is now available as flow limiting open source products that are compatible with the Spring Cloud ecology.

Compared with Hystrix, Resilience4j has the following advantages:

  1. For Java 8 and functional programming, it provides a functional and responsive API;
  2. It adds two modules, Rate Limiting and Automatic Retrying. Rate Limiting introduces a simple implementation of rate control, which complements the function of flow control. Automatic Retrying encapsulates the logic of automatic retry, which simplifies the process of exception recovery.

For another open-source alternatives to Netflix Hystrix, please go to Resilience4j and Sentinel: Two Open-Source Alternatives to Netflix Hystrix.

Related Documentation

Spring Cloud overview

EDAS supports the native Spring Cloud microservice framework. For the microservices developed under this framework, you only need to add dependencies and modify their configurations to obtain EDAS microservice hosting, microservice management, monitoring and alarm, application diagnosis, and other capabilities. This ensures zero code intrusion.

Spring Cloud provides a series of standards and specifications to simplify application development,covering service discovery, load balancing, fusion, configuration management, message event triggering, and message bus. In addition, Spring Cloud provides implementation components for service gateways, distributed tracing, security, distributed task scheduling, and distributed task coordination.

Java application monitoring and diagnosis solution

In this use case, the ARMS-based application monitoring solution is adopted to resolve pain points in monitoring distributed Java applications.

Related Blog Posts

Facilitating Enterprise-Level Internet Architecture with Alibaba Cloud Middleware

Many businesses are facing various challenges when it comes to IT because traditional IT architecture is unable to meet existing business needs. Often times this situation is worsened by the lack of a professional and business-oriented architecture for enabling microservices, as well as a lack of development resources to address application access, system compatibility, and performance problems. These combination of factors lead to complicated O&M problems that cannot be solved immediately after an enterprise-level Internet architecture is put into use, resulting in flooding business complaints.

Enterprise Distributed Application Service (EDAS) provides a complete runtime environment for microservice frameworks Dubbo and Spring Cloud, which can be deployed directly on EDAS without modifying any Java code. Enterprises can then take advantage of standard open source frameworks while at the same time enjoying enterprise-level ease-of-use and stability.

Tracing Analysis tracks all microservice requests in a distributed architecture and forms a distributed call trace, and is able to query, diagnose, and summarize in real time the application performance of a single service or resource of an application in distributed traces. The collected trace data is used for log analysis and is available on downstream analysis platforms for offline analysis and alarming, enhancing the value of trace data. In addition, Tracing Analysis complies with the OpenTracing standard, improving the availability and robustness of tracing systems.

Using API Gateway with Alibaba Cloud's Function Compute

Alibaba Cloud's API Gateway service has convenient maintenance, observation, and measurement tools, such as monitoring, alarms, and analysis. It also enables speedy and reliable microservice integration, front and back end separation, and robust system integration at low cost.

Alibaba Cloud's Function Compute service can run many different types of applications, including API gateways, data lake analyses, log stores and backups, web crawlers, and image recognition applications, to name just a few. With Function Compute, developing is convenient and reliable. Function Compute supports many different programming languages including Java, Python, PHP, and NodeJS.

In this tutorial, we will use Alibaba Cloud's Function Compute product to create a function that returns a result to the API Gateway service.

Related Products

Container Service

Container Service is a high-performance and scalable container application management service that enables you to use Docker and Kubernetes to manage the lifecycle of containerized applications.

Container Service offers a variety of application publishing methods and continuous delivery capabilities and supports microservice architectures.

Application Configuration Management

Application Configuration Management centralizes the management of application configurations and performs real time configuration push in a distributed environment. ACM also supports computer-programming languages and frameworks including Java (Spring-Cloud), Node.JS, and Python.

0 0 0
Share on

Alibaba Clouder

2,628 posts | 706 followers

You may also like


Alibaba Clouder

2,628 posts | 706 followers

Related Products

  • EDAS

    A PaaS platform for a variety of application deployment options and microservices solutions to help you monitor, diagnose, operate and maintain your applications

    Learn More
  • Tracing Analysis

    Allows developers to quickly diagnose and analyze application performance bottlenecks and root causes in distributed architecture frameworks.

    Learn More
  • API Gateway

    API Gateway provides you with high-performance and high-availability API hosting services to deploy and release your APIs on Alibaba Cloud products.

    Learn More