SlideShare a Scribd company logo
Presented By:
Resilience4j
With
Spring Boot
Shashikant Tanti &
Deepak Kumar
KnolX Etiquettes
Punctuality
Join the session 5 minutes prior
to the session start time. We
start on time and conclude on
time!
Feedback
Make sure to submit a
constructive feedback for all
sessions as it is very helpful for
the presenter.
Silent Mode
Keep your mobile devices in
silent mode, feel free to move
out of session in case you need
to attend an urgent call.
Avoid Disturbance
Avoid unwanted chit chat during
the session.
Our Agenda
01 What is Resilience4j?
02 Why Resilience4j?
03 Resilience4j Modules
04 How to use Resilience4j in your project?
05 Demo
What is Resilience4j?
● Resilience4j is an easy-to-use fault tolerance library inspired by
Netflix Hystrix, but designed for Java 8 and functional
programming.
● In Resilience4j you donʼt have to go all-in, you can pick what
you need.
Why Resilience4j?
● This library is capable of handling the asynchronous calls
● Resilience4j is designed for Java8 and functional programming
● Resilience4j enables the resilience in complex distributed systems
where failure might take place
● Resilience4j is lightweight because it only uses Vavr, which does not
have any other external library dependencies.
How to use Resilience4j in your projects?
You can simply use the following dependency in your maven project and get started
with the Resilience4j
To add the Resilience4j dependency to your project, you need to add the following
dependency to your pom.xml file:
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot2</artifactId>
<version>1.3.3</version>
</dependency>
Resilience4j Module
● Circuit Breaker
● Retry
● Rate Limiter
● BulkHead
● Time Limiter
● Cache
Circuit Breaker Module
● The circuit breaker is essentially a pattern that helps to prevent
cascading failures in a system.
● The circuit breaker pattern allows you to build a fault-tolerant
and resilient system that can survive gracefully when key services
are either unavailable or have high latency.
● Circuit breaker pattern is generally used in microservices
architecture where there are multiple services involved but it can
be used otherwise as well.
Circuit Breaker Module
The circuit breaker has the following 3 states
Closed – Closed is when everything is normal, in the beginning,
it will be in the closed state and if failures exceed the
threshold value decided at the time of creating circuit breaker,
the circuit will trip and go into an open state.
Open – Open is the state when the calls start to fail without any
latency i.e calls will start to fail fast without even executing the
function calls.
Circuit Breaker Module
Half-open – In half-open state what will happen is, the very first
call will not fail fast and all other calls will fail fast just as in the
open state. If the first call succeeds then the circuit will go
inthe closed state again and otherwise, it will go into the open
state again waiting for the reset timeout.
Circuit Breaker
BulkHead Pattern
The BulkHead Pattern is a type of application design that is
tolerant of failure. In a bulkhead architecture, elements of an
application isolated into pools so that if one fails, the other will
continue of function.
BulkHead Implementation framework
1. Hystrix
2. Resilience4j
BulkHead Pattern
When to use BulkHead Pattern
1. Apply the bulkhead pattern whenever you want to scale a
service independent of other services.
2. Isolate resources used to consume a set of backed services,
especially if the application can provide some level of
functionality even when one of the service is not responding.
3. Apply the bulkhead pattern to fault isolate components of
varying risk or availability requirements.
4. Protect the application from cascading failure.
Retry Module
● There can be scenarios when there are intermittent network
connectivity errors causing your service to be unavailable.
● These issues are generally self-correcting and if you retry the
operation after a small delay its most probably going to succeed.
● Retry pattern help to resolve transient failures in distributed
architecture by automatically hit the target resource again after
some specific time.
user-service catalog-service
Resilience4j:
retry:
instances:
userService:
maxRetryAttempts: 4
waitDuration: 5s
Service A Service B
Failure response
Retry
1
2
3
4
The faults are expected to be short lived, and repeating request
that failed previously could succeed on a subsequent attempt.
● Calling an HTTP service from another REST endpoint.
● Calling a web service.
● No or slow responses due to a large number of requests towards
the resource(database or service).
When to use Retry
1. Setting a limit on the amount of time we are willing to wait for an
operation to complete is called time limiting.
2. If the operation does not complete within the time specified, we
want to notified about it with a timeout error.
Time Limiter
Resilience4jʼs TimeLimiter can be used to set limits (timeouts) on
asynchronous operations implemented with completableFuture.
Configuration
timeoutDuration:2s
cancelRunningFuture:true
Resilience4j Time Limiter
Rate limiter pattern helps us to make services highly available
just by limiting the number of calls we could process in a
specific window.
Rate limiting specified in terms of
1. Requests per second(rpc)
2. Requests per minute(rpm)
3. Requests per hour(rph)
Rate Limiter Pattern
Resilience4j-ratelimiter
● https://resilience4j.readme.io/docs/getting-started
● https://github.com/resilience4j/resilience4j
●
https://blog.knoldus.com/circuit-breaker-with-resilience4j/
● https://blog.knoldus.com/retry-with-resilience4j/
References
Thank You !
Thank You
!
Demo
Do remember to submit
feedback!
Thank You !

More Related Content

What's hot (20)

PDF
[Webinar]: Working with Reactive Spring
Knoldus Inc.
 
PDF
ActiveMQ In Action
Bruce Snyder
 
ODP
ansible why ?
Yashar Esmaildokht
 
PDF
SpringBoot 3 Observability
Knoldus Inc.
 
PDF
Ansible - Hands on Training
Mehmet Ali Aydın
 
PPTX
Node js Introduction
sanskriti agarwal
 
PPTX
Introduction to Node.js
AMD Developer Central
 
PPTX
Apache tomcat
Shashwat Shriparv
 
PDF
Spring Boot
Jaran Flaath
 
PPT
SOLID Design Principles
Andreas Enbohm
 
PPTX
Kubernetes introduction
Dongwon Kim
 
PDF
High Availability for OpenStack
Kamesh Pemmaraju
 
ODP
Introduction to Ansible
Knoldus Inc.
 
PPTX
Introduction to react_js
MicroPyramid .
 
PPTX
Circuit Breaker Pattern
Tung Nguyen
 
PPTX
Spring Webflux
Carlos E. Salazar
 
PPTX
Springboot Microservices
NexThoughts Technologies
 
PDF
Introduction to Kubernetes Workshop
Bob Killen
 
PDF
React & GraphQL
Nikolas Burk
 
PDF
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
[Webinar]: Working with Reactive Spring
Knoldus Inc.
 
ActiveMQ In Action
Bruce Snyder
 
ansible why ?
Yashar Esmaildokht
 
SpringBoot 3 Observability
Knoldus Inc.
 
Ansible - Hands on Training
Mehmet Ali Aydın
 
Node js Introduction
sanskriti agarwal
 
Introduction to Node.js
AMD Developer Central
 
Apache tomcat
Shashwat Shriparv
 
Spring Boot
Jaran Flaath
 
SOLID Design Principles
Andreas Enbohm
 
Kubernetes introduction
Dongwon Kim
 
High Availability for OpenStack
Kamesh Pemmaraju
 
Introduction to Ansible
Knoldus Inc.
 
Introduction to react_js
MicroPyramid .
 
Circuit Breaker Pattern
Tung Nguyen
 
Spring Webflux
Carlos E. Salazar
 
Springboot Microservices
NexThoughts Technologies
 
Introduction to Kubernetes Workshop
Bob Killen
 
React & GraphQL
Nikolas Burk
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 

Similar to Resilience4j with Spring Boot (20)

PPTX
Circuit Breaker.pptx
HrishikeshSarate
 
PPTX
Максим Говорищев, "Exploring fault-tolerance patterns with Resilience4j"
Sigma Software
 
PPTX
Microservices Resilient Engineering - Java meetup.pptx
erohana
 
PPTX
Resilience engineering
Sumanth Chinthagunta
 
PPTX
Circuit breaker pattern
Ankit Gubrani
 
PDF
Resilient service to-service calls in a post-Hystrix world
Rares Musina
 
PDF
Expect the unexpected: Prepare for failures in microservices
Bhakti Mehta
 
PDF
Fault tolerance made easy
Uwe Friedrichsen
 
PPTX
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...
Firmansyah, SCJP, OCEWCD, OCEWSD, TOGAF, OCMJEA, CEH
 
PDF
Circuit breakers - Using Spring-Boot + Hystrix + Dashboard + Retry
Bruno Henrique Rother
 
PDF
Introduction of failsafe
Sunghyouk Bae
 
PDF
Resilience Planning & How the Empire Strikes Back
C4Media
 
PDF
Fault tolerance - look, it's simple!
Izzet Mustafaiev
 
PPTX
Expect the unexpected: Anticipate and prepare for failures in microservices b...
Bhakti Mehta
 
PPTX
Resilience planning and how the empire strikes back
Bhakti Mehta
 
PDF
Patterns of resilience
Uwe Friedrichsen
 
PPTX
JDD 2017: Resilience of the external system call with circuit breaker (Jacek ...
PROIDEA
 
PDF
Resilence patterns kr
Jisung Ahn
 
PDF
Why resilience - A primer at varying flight altitudes
Uwe Friedrichsen
 
PDF
Architecting for Failures in micro services: patterns and lessons learned
Bhakti Mehta
 
Circuit Breaker.pptx
HrishikeshSarate
 
Максим Говорищев, "Exploring fault-tolerance patterns with Resilience4j"
Sigma Software
 
Microservices Resilient Engineering - Java meetup.pptx
erohana
 
Resilience engineering
Sumanth Chinthagunta
 
Circuit breaker pattern
Ankit Gubrani
 
Resilient service to-service calls in a post-Hystrix world
Rares Musina
 
Expect the unexpected: Prepare for failures in microservices
Bhakti Mehta
 
Fault tolerance made easy
Uwe Friedrichsen
 
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...
Firmansyah, SCJP, OCEWCD, OCEWSD, TOGAF, OCMJEA, CEH
 
Circuit breakers - Using Spring-Boot + Hystrix + Dashboard + Retry
Bruno Henrique Rother
 
Introduction of failsafe
Sunghyouk Bae
 
Resilience Planning & How the Empire Strikes Back
C4Media
 
Fault tolerance - look, it's simple!
Izzet Mustafaiev
 
Expect the unexpected: Anticipate and prepare for failures in microservices b...
Bhakti Mehta
 
Resilience planning and how the empire strikes back
Bhakti Mehta
 
Patterns of resilience
Uwe Friedrichsen
 
JDD 2017: Resilience of the external system call with circuit breaker (Jacek ...
PROIDEA
 
Resilence patterns kr
Jisung Ahn
 
Why resilience - A primer at varying flight altitudes
Uwe Friedrichsen
 
Architecting for Failures in micro services: patterns and lessons learned
Bhakti Mehta
 
Ad

More from Knoldus Inc. (20)

PPTX
Angular Hydration Presentation (FrontEnd)
Knoldus Inc.
 
PPTX
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
Knoldus Inc.
 
PPTX
Self-Healing Test Automation Framework - Healenium
Knoldus Inc.
 
PPTX
Kanban Metrics Presentation (Project Management)
Knoldus Inc.
 
PPTX
Java 17 features and implementation.pptx
Knoldus Inc.
 
PPTX
Chaos Mesh Introducing Chaos in Kubernetes
Knoldus Inc.
 
PPTX
GraalVM - A Step Ahead of JVM Presentation
Knoldus Inc.
 
PPTX
Nomad by HashiCorp Presentation (DevOps)
Knoldus Inc.
 
PPTX
Nomad by HashiCorp Presentation (DevOps)
Knoldus Inc.
 
PPTX
DAPR - Distributed Application Runtime Presentation
Knoldus Inc.
 
PPTX
Introduction to Azure Virtual WAN Presentation
Knoldus Inc.
 
PPTX
Introduction to Argo Rollouts Presentation
Knoldus Inc.
 
PPTX
Intro to Azure Container App Presentation
Knoldus Inc.
 
PPTX
Insights Unveiled Test Reporting and Observability Excellence
Knoldus Inc.
 
PPTX
Introduction to Splunk Presentation (DevOps)
Knoldus Inc.
 
PPTX
Code Camp - Data Profiling and Quality Analysis Framework
Knoldus Inc.
 
PPTX
AWS: Messaging Services in AWS Presentation
Knoldus Inc.
 
PPTX
Amazon Cognito: A Primer on Authentication and Authorization
Knoldus Inc.
 
PPTX
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
Knoldus Inc.
 
PPTX
Managing State & HTTP Requests In Ionic.
Knoldus Inc.
 
Angular Hydration Presentation (FrontEnd)
Knoldus Inc.
 
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
Knoldus Inc.
 
Self-Healing Test Automation Framework - Healenium
Knoldus Inc.
 
Kanban Metrics Presentation (Project Management)
Knoldus Inc.
 
Java 17 features and implementation.pptx
Knoldus Inc.
 
Chaos Mesh Introducing Chaos in Kubernetes
Knoldus Inc.
 
GraalVM - A Step Ahead of JVM Presentation
Knoldus Inc.
 
Nomad by HashiCorp Presentation (DevOps)
Knoldus Inc.
 
Nomad by HashiCorp Presentation (DevOps)
Knoldus Inc.
 
DAPR - Distributed Application Runtime Presentation
Knoldus Inc.
 
Introduction to Azure Virtual WAN Presentation
Knoldus Inc.
 
Introduction to Argo Rollouts Presentation
Knoldus Inc.
 
Intro to Azure Container App Presentation
Knoldus Inc.
 
Insights Unveiled Test Reporting and Observability Excellence
Knoldus Inc.
 
Introduction to Splunk Presentation (DevOps)
Knoldus Inc.
 
Code Camp - Data Profiling and Quality Analysis Framework
Knoldus Inc.
 
AWS: Messaging Services in AWS Presentation
Knoldus Inc.
 
Amazon Cognito: A Primer on Authentication and Authorization
Knoldus Inc.
 
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
Knoldus Inc.
 
Managing State & HTTP Requests In Ionic.
Knoldus Inc.
 
Ad

Recently uploaded (20)

PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
PPTX
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 

Resilience4j with Spring Boot

  • 2. KnolX Etiquettes Punctuality Join the session 5 minutes prior to the session start time. We start on time and conclude on time! Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter. Silent Mode Keep your mobile devices in silent mode, feel free to move out of session in case you need to attend an urgent call. Avoid Disturbance Avoid unwanted chit chat during the session.
  • 3. Our Agenda 01 What is Resilience4j? 02 Why Resilience4j? 03 Resilience4j Modules 04 How to use Resilience4j in your project? 05 Demo
  • 4. What is Resilience4j? ● Resilience4j is an easy-to-use fault tolerance library inspired by Netflix Hystrix, but designed for Java 8 and functional programming. ● In Resilience4j you donʼt have to go all-in, you can pick what you need.
  • 5. Why Resilience4j? ● This library is capable of handling the asynchronous calls ● Resilience4j is designed for Java8 and functional programming ● Resilience4j enables the resilience in complex distributed systems where failure might take place ● Resilience4j is lightweight because it only uses Vavr, which does not have any other external library dependencies.
  • 6. How to use Resilience4j in your projects? You can simply use the following dependency in your maven project and get started with the Resilience4j To add the Resilience4j dependency to your project, you need to add the following dependency to your pom.xml file: <dependency> <groupId>io.github.resilience4j</groupId> <artifactId>resilience4j-spring-boot2</artifactId> <version>1.3.3</version> </dependency>
  • 7. Resilience4j Module ● Circuit Breaker ● Retry ● Rate Limiter ● BulkHead ● Time Limiter ● Cache
  • 8. Circuit Breaker Module ● The circuit breaker is essentially a pattern that helps to prevent cascading failures in a system. ● The circuit breaker pattern allows you to build a fault-tolerant and resilient system that can survive gracefully when key services are either unavailable or have high latency. ● Circuit breaker pattern is generally used in microservices architecture where there are multiple services involved but it can be used otherwise as well.
  • 9. Circuit Breaker Module The circuit breaker has the following 3 states Closed – Closed is when everything is normal, in the beginning, it will be in the closed state and if failures exceed the threshold value decided at the time of creating circuit breaker, the circuit will trip and go into an open state. Open – Open is the state when the calls start to fail without any latency i.e calls will start to fail fast without even executing the function calls.
  • 10. Circuit Breaker Module Half-open – In half-open state what will happen is, the very first call will not fail fast and all other calls will fail fast just as in the open state. If the first call succeeds then the circuit will go inthe closed state again and otherwise, it will go into the open state again waiting for the reset timeout.
  • 12. BulkHead Pattern The BulkHead Pattern is a type of application design that is tolerant of failure. In a bulkhead architecture, elements of an application isolated into pools so that if one fails, the other will continue of function. BulkHead Implementation framework 1. Hystrix 2. Resilience4j
  • 14. When to use BulkHead Pattern 1. Apply the bulkhead pattern whenever you want to scale a service independent of other services. 2. Isolate resources used to consume a set of backed services, especially if the application can provide some level of functionality even when one of the service is not responding. 3. Apply the bulkhead pattern to fault isolate components of varying risk or availability requirements. 4. Protect the application from cascading failure.
  • 15. Retry Module ● There can be scenarios when there are intermittent network connectivity errors causing your service to be unavailable. ● These issues are generally self-correcting and if you retry the operation after a small delay its most probably going to succeed. ● Retry pattern help to resolve transient failures in distributed architecture by automatically hit the target resource again after some specific time.
  • 17. The faults are expected to be short lived, and repeating request that failed previously could succeed on a subsequent attempt. ● Calling an HTTP service from another REST endpoint. ● Calling a web service. ● No or slow responses due to a large number of requests towards the resource(database or service). When to use Retry
  • 18. 1. Setting a limit on the amount of time we are willing to wait for an operation to complete is called time limiting. 2. If the operation does not complete within the time specified, we want to notified about it with a timeout error. Time Limiter
  • 19. Resilience4jʼs TimeLimiter can be used to set limits (timeouts) on asynchronous operations implemented with completableFuture. Configuration timeoutDuration:2s cancelRunningFuture:true Resilience4j Time Limiter
  • 20. Rate limiter pattern helps us to make services highly available just by limiting the number of calls we could process in a specific window. Rate limiting specified in terms of 1. Requests per second(rpc) 2. Requests per minute(rpm) 3. Requests per hour(rph) Rate Limiter Pattern
  • 23. Thank You ! Thank You ! Demo
  • 24. Do remember to submit feedback!