Skip to content

dash-spv: header requests wait behind megabytes of bulk data on the same peer #1235

Closed

Description

@xdustinface

All paths are under dash-spv/src/ at 8dde9d0c (dev after #902).

The router picks the peer with the lowest in_flight / cap for every message, whatever its type (network/broker.rs:259-262), and drains headers last (network/broker.rs:18-19, 4 guaranteed slots per class at :16, :243). A slow peer with an inflated cap looks least loaded, so a getheaders lands behind its filter and block backlog. Because any reply refreshes the peer's progress clock, a stuck getheaders also never expires while that peer trickles data. Dev bounded bulk requests per peer and retried a header request after 30s.

Evidence. The benchmark runs are 12 interleaved full testnet syncs of the #902 head 39eef40d against dev 0dcdd823. The network code is byte-identical to what landed on dev.

  • Header phase median 96s on dev and 149s on the refactor (Mann-Whitney p=0.005, 12 runs each).
  • Gap between responses on one header segment: mean 3.05s against 4.84s, with the same number of segments in flight (about 5.3 and 5.2).
  • Queued seconds per peer (in_flight / rate) correlate with header completion time at r=0.81 across the refactor runs.
  • In one run 68.67.122.57 held 5.5 MB in flight at a median 0.11 MB/s during the header phase, with a cap of up to 37 MB.
  • Ruled out: DGW header validation (both branches have it) and the headers2 decoding path.

Fix. Route header requests by queued time (in_flight / rate) rather than cap ratio, or bound how much bulk work a peer may hold ahead of a header request. The cap runaway in #1220 makes this worse.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions