This release introduces the Exponential Backoff strategy, a new adaptive hedging mechanism designed for rate-limited APIs and services with variable health. Unlike percentile-based strategies, this approach does not require a warmup period and adapts rapidly to service degradation.
New Features:
- Implemented CrucibleHedging.Strategy.ExponentialBackoff GenServer.
- Implemented adaptive logic based on TCP congestion control principles:
-- Decreases delay on successful hedges (multiplicative decrease).
-- Increases delay on failed hedges (multiplicative increase).
-- Aggressively increases delay on errors.
- Added support for strategy_name to isolate backoff state per backend service.
- Added comprehensive configuration options (base_delay, min/max bounds, adjustment factors).
Core Changes:
- Updated CrucibleHedging.request/2 to pass strategy_name to the strategy implementation.
- Updated error handling flow to report exceptions to the strategy, allowing the backoff mechanism to react to timeouts and crashes.
- Registered the new :exponential_backoff strategy in the Strategy module.
Configuration:
- Updated CrucibleHedging.Config with new parameters (exponential_min_delay, exponential_increase_factor, etc.).
- Added validation logic to ensure min < max and that adjustment factors are mathematically valid for convergence.
Documentation and Testing:
- Added 100% test coverage for the new strategy in test/strategy/exponential_backoff_test.exs.
- Added detailed design document and implementation summary in docs/20251125/.
- Updated README.md with algorithm details, usage examples, and comparison to existing strategies.
- Updated CHANGELOG.md for v0.2.0.
- Bumped project version in mix.exs.