Skip to main content

exponential_backoff_with_jitter

Function exponential_backoff_with_jitter 

Source
pub fn exponential_backoff_with_jitter(
    base_ms: u64,
    multiplier: u64,
    exponent: u32,
    cap_ms: u64,
) -> u64
Expand description

计算带全抖动的指数退避(毫秒):[0, exponential_backoff] 均匀随机

Full Jitter(AWS 架构中心推荐):在多实例同时退避重试时打散同步性, 避免惊群。随机源为线程本地 splitmix64(无安全要求,热路径零系统调用)。