Skip to content

Improve voyager load performance - #6016

Open
kellen wants to merge 3 commits into
mainfrom
kellen/voyager-fast-load
Open

kellen wants to merge 3 commits into
mainfrom
kellen/voyager-fast-load

Conversation

@kellen

@kellen kellen commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Currently, the voyager side input downloads its files disk, but the worker disk is not reused upon crashes, so persisting the voyager files to disk by default introduces excess latency.

This PR introduces a buffering-retrying parallel-download input stream for use with voyager, ParallelRangeInputStream. Ranges which fail are retried from the last-read byte.

Backed by ParallelRangeInputStream, voyager data is now read directly into memory, sidestepping the round-trip to disk. For names.json, uses jackson streaming instead of TinyJson.

kellen and others added 2 commits October 14, 2026 13:34
Voyager's StringIndex.load parses names.json with a regex-based
java.util.Scanner, which dominates load time for large name lists.
VoyagerReader now holds a raw Index plus a names array, parses names
with a streaming byte-level parser, and loads the index and names
concurrently.

On a 2M-name / 405 MiB index: names parsing ~10x faster, total reader
load ~3-4x faster. The parser streams in chunks, so names files larger
than 2GB are supported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remote voyager indexes are no longer downloaded to local disk before
loading. ParallelRangeInputStream fetches fixed-size byte ranges in
parallel and serves them in order to Index.load(InputStream) and the
names parser, removing the disk write and read-back.

Each range retries independently with exponential backoff and jitter,
resuming from the last byte received; a range only fails after many
consecutive attempts without progress, so transient failures such as
GCS rate limiting never reach the native loader. The stream verifies
the source was not modified during the read. Completed ranges can
optionally be spilled to local disk for reuse by a later attempt
(off by default, since spilling caps throughput at disk speed).

names.json is now parsed with Jackson's streaming parser instead of a
custom parser, rejecting anything other than a flat list of strings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.17647% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.60%. Comparing base (4f6c6d5) to head (0cbdd8f).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
.../scio/extra/voyager/ParallelRangeInputStream.scala 82.03% 23 Missing ⚠️
...scala/com/spotify/scio/extra/voyager/Voyager.scala 81.57% 7 Missing ⚠️
.../scio/extra/voyager/syntax/SCollectionSyntax.scala 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6016      +/-   ##
==========================================
+ Coverage   62.03%   62.60%   +0.56%     
==========================================
  Files         323      327       +4     
  Lines       11751    12018     +267     
  Branches      820      891      +71     
==========================================
+ Hits         7290     7524     +234     
- Misses       4461     4494      +33     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants