pub struct TwoRandomChoicesLb;Expand description
Two Random Choices (Power of Two Choices) load balancer.
Picks two healthy backends at random and selects the one with fewer active
connections. This achieves near-optimal load distribution with O(1)
selection cost, avoiding the global scan of LeastConnLb.
- 0 healthy backends →
None - 1 healthy backend → use it directly
- 2+ healthy backends → pick 2 at random, choose the one with fewer connections
Implementations§
Trait Implementations§
Source§impl Default for TwoRandomChoicesLb
impl Default for TwoRandomChoicesLb
Source§impl LoadBalancer for TwoRandomChoicesLb
impl LoadBalancer for TwoRandomChoicesLb
Auto Trait Implementations§
impl Freeze for TwoRandomChoicesLb
impl RefUnwindSafe for TwoRandomChoicesLb
impl Send for TwoRandomChoicesLb
impl Sync for TwoRandomChoicesLb
impl Unpin for TwoRandomChoicesLb
impl UnsafeUnpin for TwoRandomChoicesLb
impl UnwindSafe for TwoRandomChoicesLb
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more