Skip to content

gateway: concurrent pulls from one long-lived worker #2458

Closed

Description

@alpergundogdu

Summary

decdn gateway (#2456) runs one pull at a time, and every content request repeats the whole fetch_into bring-up. Serve concurrent requests from one long-lived pull worker instead.

Today

  • One global pull slot. The pull thread holds it until the response body is drained, and waiting for it has no timeout. A <video> whose browser stops reading (preload done, background tab) fills the 1 MiB pipe and holds the slot until the 120 s no-progress give-up. Every other image, entry and manifest request waits behind it.
  • Each request starts a new OS thread and current-thread runtime, reloads the config, resolves relays and discovery, opens the redb buyer store, builds a new iroh endpoint and installs a Ctrl-C watcher. A bundle page with 30 images makes 30 serialized bring-ups before bytes flow.

Design

One worker thread with a LocalSet (the fetch future is not Send) that holds one Endpoint, one buyer store and one Connections across pulls, and runs each request as a local task. Pulls under one capability share its lanes through the engine's LaneLedgers seam, so concurrent pulls never double-spend a lane. HTTP handlers send a request to the worker and stream from its pipe as today.

Open question: whether the shared-ledger multi-pull surface stays a gateway-internal use of the hidden seams or becomes public decdn-client SDK API.

Acceptance

  • Two content requests stream at once; a stalled response does not block another.
  • The endpoint and store are built once per gateway run.
  • Concurrent pulls under one capability pay correct cumulative vouchers per lane.

Raised in review of #2456.

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

    Fields

    Priority

    None yet

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions