Files
modules/routing-advanced/hyper-p2p-load-spread
2026-05-20 22:56:32 -04:00
..
2026-05-20 22:56:32 -04:00
2026-05-20 22:56:32 -04:00
2026-05-20 22:56:32 -04:00
2026-05-20 21:19:52 -04:00
2026-05-20 22:56:32 -04:00
2026-05-20 21:57:50 -04:00
2026-05-20 21:57:50 -04:00
2026-05-20 22:56:32 -04:00

hyper-p2p-load-spread

Pick the peer reporting the lowest load metric.

Protocol: load-spread/v1

When to use

  • Work-stealing or least-loaded peer selection.
  • Gossiping CPU/queue depth hints across a swarm topic.

When not to use

  • Geographic affinity (use geo-hint-router).
  • Sticky user sessions.

Quick start

const { HyperP2PLoadSpread } = require('hyper-p2p-load-spread')
const ls = new HyperP2PLoadSpread({ topic: 'workers' })
await ls.ready()
ls.registerPeer('w1', 0.2)
ls.registerPeer('w2', 0.9)
console.log(ls.pickPeer())
await ls.close()

Docs

Test

npm install && npm test