p2c

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package p2c implements a power-of-two-choices selector with time-decayed EWMA latency and success tracking, inspired by go-zero's p2c_ewma. Each pick samples two nodes and selects the one with the lower estimated load; the DoneFunc feeds observed latency/errors back into the node's EWMA. Nodes with a high failure rate are deprioritized, and stale nodes not picked recently are force-picked so a newly healthy node is not starved.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL