p2c

package
v0.0.5 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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