OXYGENHUB

The swarm moved an image at 2 MB/s: scattered reads on a spinning disk and a quadratic picker issue #97 closed: completed andymccall opened this · 0 comments

andymccall

The swarm moved an image at about 2 MB/s: plex-1 fetched 2.3 GiB from earth-1 in 1,229 s on 2026-10-26.

Causes:

  • Scattered reads on a spinning disk. Earth's disk is a 7,200 rpm WD2003FZEX. A peer serves each chunk by reading about 88 KB at its offset in the whole image. The picker broke rarity ties at random, so with one peer (every chunk equally rare) the whole fetch read the image in random order, a seek per chunk, behind CI's writes.
  • A quadratic picker. Picker::pick scanned order from the start each time, past every chunk already here or asked for: 19 s of picking for the Rust image's 142,244 chunks in a release build, before any I/O.

Fix (jet::swarm):

  • Where rarity ties, chunks come in runs of neighbours (up to 64, about 5.6 MB), the runs shuffled so runners starting together still spread out. A small image's runs are shorter, so it keeps a few hundred to spread over.
  • A cursor skips what is here or asked for, and moves back when a chunk fails. Picking the 142,244 chunks now takes 0.35 s.

Tests: neighbours in order from one peer; a failed chunk asked again first; the existing rarest-first, endgame and spreading tests; an ignored timing test for an image of this size.

andymccall set labels performance ·

closed by change 069e16fba3bd ·