Skip to content

kad: replace round-synchronized lookup with a continuous alpha-concurrency pipeline #2854

Description

@gmelodie

find.nim:369 lookOnce dispatches alpha peers per round, then blocks on collectCompleted(timeout) for the whole batch before starting the next round. A single slow peer stalls the entire round up to the timeout.

go-libp2p's query.run() keeps up to alpha queries continuously in flight over a channel, refilling a slot as soon as any query returns, so lookup wall-clock tracks throughput rather than the slowest peer per round.

Proposed work:

  • Refactor lookOnce/iterativeLookup so that instead of awaiting a full batch, it maintains alpha in-flight dispatches and re-dispatches the next-closest unqueried peer whenever one completes.
  • Preserve existing stop conditions and inflight-cancellation bookkeeping.

Impact: lookup latency, especially with straggler peers. High.

Metadata

Metadata

Assignees

Labels

General improvementGeneral improvement: Refactor, style improvement, stricter types, etc.

Fields

No fields configured for Enhancement.

Projects

Status
new

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions