Skip to main content

LoadMetric

Trait LoadMetric 

Source
pub trait LoadMetric: Send + Sync {
    // Required method
    fn load_score(&self) -> f64;
}
Expand description

Exposes a load score for load-aware strategies. Lower is better.

Required Methods§

Source

fn load_score(&self) -> f64

Current load score. Strategies like LeastLoad and PowerOfTwoChoices use this to prefer less-loaded nodes.

Should return a finite, non-NaN value. With LeastLoad, a NaN node is never selected (NaN < x is always false). With PowerOfTwoChoices, a NaN node may be selected because P2C uses <= (x <= NaN is false, causing the NaN node to win the comparison).

Implementors§