Skip to content

Add jitter to retry logic in PartitionKeyResolver#77

Merged
dkropachev merged 1 commit intomainfrom
fix/retry-logic-jitter
Mar 4, 2026
Merged

Add jitter to retry logic in PartitionKeyResolver#77
dkropachev merged 1 commit intomainfrom
fix/retry-logic-jitter

Conversation

@dkropachev
Copy link
Collaborator

@dkropachev dkropachev commented Mar 4, 2026

Summary

  • Add random jitter to exponential backoff delays to prevent thundering herd problem
  • Improve retry reliability when multiple clients encounter failures simultaneously

Changes

  • Add calculateJitteredDelay() method with ±20% random jitter
  • Apply jitter to both DynamoDbException and general Exception retry paths
  • Update log messages to show actual jittered delay values
  • Ensure minimum 1ms delay after jitter calculation

Test plan

  • Verify compilation passes
  • Test that retry delays now include random jitter
  • Confirm jitter is applied within expected range (±20%)
  • Verify no behavioral changes to retry logic flow

@dkropachev dkropachev force-pushed the fix/retry-logic-jitter branch from 2d72e85 to 1e7cc41 Compare March 4, 2026 14:52
Prevents thundering herd problem during DescribeTable retries:
- Add random jitter (±20%) to exponential backoff delays
- Update both DynamoDbException and general Exception retry paths
- Log actual jittered delay values for debugging
- Ensure minimum 1ms delay after jitter calculation

This reduces the chance of multiple clients retrying simultaneously
after failures, improving overall system stability.
@dkropachev dkropachev force-pushed the fix/retry-logic-jitter branch from 1e7cc41 to e92bbe3 Compare March 4, 2026 14:54
@dkropachev dkropachev merged commit 1a1b1de into main Mar 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant