Skip to content

perf (speculative): evaluate cross-title parallelism for libby archive --all — titles currently download strictly sequentially #14

Description

@JavaGT

Finding (performance-audit, 0300 run 2026-09-12)

Speculative — evaluate whether this is worth doing. Implementation is explicitly NOT the todo.

bin/libby.mjs:494-501 archives targets in a strict for…of await loop: with N loans, wall-clock is the sum of per-title archives. Within a single title, part downloads already run with bounded concurrency (mapLimit, src/pool.mjs), and HTTP keep-alive pooling landed in W7 — cross-title serialization is the remaining structural serialization in the heaviest command.

Why evaluate first, not implement

  • Rate-limit tradeoff is an owner call: OverDrive throttles ("whoa", handled at bin/libby.mjs:506-511 with exit 3). Cross-title concurrency multiplies concurrent sockets against OverDrive hosts; whether N=2 is safe vs. whoa-prone needs a measured answer, not a guess.
  • Measurement infra doesn't exist: an honest before/after needs a simulated multi-title archive (net-sim harness driving archiveAudiobook/archiveReadable with mocked clients) or real downloads; neither is built.
  • Error-semantics design: today a mid-loop failure logs FAILED "title" and continues; whoa exits 3. Parallel completion interleaves logs and can surface several failures/whoas per run — the semantics need re-specifying before code.

Evaluation questions for the owner

  1. Is a bounded mapLimit(targets, 2) (or 3) archive loop worth building given whoa risk?
  2. If yes, fund the net-sim multi-title harness so the win is measured, not assumed.

Evidence

  • bin/libby-archiver src: serial loop at bin/libby.mjs:494-501; per-title concurrency at src/archive.mjs:20/src/archive-read.mjs:27 (mapLimit).
  • Context: W7 keep-alive pooling (bb616b3, perf-notes-net.md) removed per-request handshakes; T2 waves optimized loops/RAM.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions