Power of two choices
Shippedalias p2c
Sample two candidates, pick the less loaded. Near-optimal and O(1).
Example
How Power of two choices decides — the pool is evaluated and the winner is assigned. Each strategy selects differently.
▸ Show the code
// Power of two choices selects from the pool and assigns.engine.Route(ductor.Route{ Match: `routable.type == "lead"`, Strategy: "power_of_two_choices", Pool: "sales-team",}) // Durable, observable, exactly-once.decision, err := engine.Dispatch(ctx, routable)How it works
Envoy's default load balancer. Picks two recipients at random and routes to the one with lower load — near-optimal balancing without the herding of global least-loaded, at constant cost.
Stateful