Retry Pattern
What is Retry Pattern?
What is Retry Pattern?
Category
Reliability
What is Retry Pattern?
Category
Reliability
Enable an application to handle transient failures when it tries to connect to a service or
network resource, by transparently retrying a failed operation.
What is Retry Pattern?
Category
Reliability
Enable an application to handle transient failures when it tries to connect to a service or
network resource, by transparently retrying a failed operation.
Related Patterns
Circuit Breaker Pattern
Service
Service
Service
Service
Service
Service
Service
Service
1
Service
2
Service
1
Service
2
Retry Strategies
Retry Strategies
1 - Cancel
Retry Strategies
1 - Cancel
Not transient
Retry Strategies
1 - Cancel
Not transient
Unlikely to succussed if repeated
Retry Strategies
1 - Cancel
Not transient
Unlikely to succussed if repeated
Should cancel the operation and report an exception
Retry Strategies
1 - Cancel
Not transient
Unlikely to succussed if repeated
Should cancel the operation and report an exception
Example:
Authentication failure
Retry Strategies
2 - Retry
Retry Strategies
2 - Retry
Uncommon or rare faults
Retry Strategies
2 - Retry
Uncommon or rare faults.
Unlikely to be repeated
Retry Strategies
2 - Retry
Uncommon or rare faults
Unlikely to be repeated
Should retry the failed operation immediately
Retry Strategies
3 – Retry after delay
Retry Strategies
3 – Retry after delay
Connectivity or busy faults.
Retry Strategies
3 – Retry after delay
Connectivity or busy faults
Unlikely to be repeated
Retry Strategies
3 – Retry after delay
Connectivity or busy faults
Unlikely to be repeated
Should wait for a suitable time before retry the failed operation.
Considerations
Considerations
matching with business requirements and the nature of the failure.
Considerations
matching with business requirements and the nature of the failure.
Avoid aggressive retry policy with minimal delay between attempts.
Considerations
matching with business requirements and the nature of the failure.
Avoid aggressive retry policy with minimal delay between attempts.
Consider implementing Circuit Breaker Pattern.
Considerations
matching with business requirements and the nature of the failure.
Avoid aggressive retry policy with minimal delay between attempts.
Consider implementing Circuit Breaker Pattern.
Retry with idempotent operation
Considerations
matching with business requirements and the nature of the failure.
Avoid aggressive retry policy with minimal delay between attempts.
Consider implementing Circuit Breaker Pattern.
Retry with idempotent operation
Adjust the time between retry attempts based on the type of the exception.
Considerations
matching with business requirements and the nature of the failure.
Avoid aggressive retry policy with minimal delay between attempts.
Consider implementing Circuit Breaker Pattern.
Retry with idempotent operation
Adjust the time between retry attempts based on the type of the exception.
Retrying an operation that's part of a transaction
Considerations
matching with business requirements and the nature of the failure.
Avoid aggressive retry policy with minimal delay between attempts.
Consider implementing Circuit Breaker Pattern.
Retry with idempotent operation
Adjust the time between retry attempts based on the type of the exception.
Retrying an operation that's part of a transaction
only when the full context of a failing operation is understood.
Considerations
matching with business requirements and the nature of the failure.
Avoid aggressive retry policy with minimal delay between attempts.
Consider implementing Circuit Breaker Pattern.
Retry with idempotent operation
Adjust the time between retry attempts based on the type of the exception.
Retrying an operation that's part of a transaction
only when the full context of a failing operation is understood.
Testing
Considerations
matching with business requirements and the nature of the failure.
Avoid aggressive retry policy with minimal delay between attempts.
Consider implementing Circuit Breaker Pattern.
Retry with idempotent operation
Adjust the time between retry attempts based on the type of the exception.
Retrying an operation that's part of a transaction
only when the full context of a failing operation is understood.
Testing
Logging
Considerations
matching with business requirements and the nature of the failure.
Avoid aggressive retry policy with minimal delay between attempts.
Consider implementing Circuit Breaker Pattern.
Retry with idempotent operation
Adjust the time between retry attempts based on the type of the exception.
Retrying an operation that's part of a transaction
only when the full context of a failing operation is understood.
Testing
Logging
Investigate the faults.
When to use this pattern?
When to use this pattern?
Transient faults when interacts with a remote service or accesses a remote
resource.
When to use this pattern?
Transient faults when interacts with a remote service or accesses a remote
resource.
Short lived fault, and repeating a request that has previously failed could
succeed on a subsequent attempt.
When NOT to use this pattern?
When NOT to use this pattern?
Long lasting faults.
When NOT to use this pattern?
Long lasting faults.
Errors in the business logic of an application.
When NOT to use this pattern?
Long lasting faults.
Errors in the business logic of an application.
As an alternative to addressing scalability issues in a system.
Thank You!