feat(bulk-submit): ingest a manifest's output files concurrently (fan-out) - #933
Merged
Conversation
…-out) A worker processed a manifest's output files one at a time. With a concurrent-writer backend (PostgreSQL) that leaves most of the machine idle: the bottleneck is per-resource CPU, and one worker is one core's worth. HFS_BULK_SUBMIT_FILE_CONCURRENCY (default 1 = today's sequential behavior) runs up to N files at once through a bounded buffer_unordered stream, so their fetch, parse, and write overlap. Counts accumulate into shared atomics; per-file failures are recorded and counted without aborting the manifest, and only a storage error on the bookkeeping path aborts the job — the same semantics as the sequential loop. Measured on the 31GB benchmark manifest, single submission: ~5x on PostgreSQL (concurrent writers), ~1.4x on SQLite (single writer caps it).
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A worker processed a manifest's
outputfiles one at a time. Since the bottleneck is per-resource CPU, one sequential worker is one core's worth — and a concurrent-writer backend (PostgreSQL) sits mostly idle.What
HFS_BULK_SUBMIT_FILE_CONCURRENCY(default1= today's sequential behavior) ingests up to N of a manifest's files at once through a boundedbuffer_unorderedstream, so their fetch, parse, and write overlap. Counts accumulate into shared atomics; per-file failures are recorded and counted without aborting the manifest, and only a storage error on the bookkeeping path aborts the job — identical semantics to the sequential loop.Measured
On the 31 GB benchmark manifest, a single submission (no manual splitting): ~5× on PostgreSQL (concurrent writers scale), ~1.4× on SQLite (the single writer caps it). Combined with the search-index allowlist, this brings the full 31 GB import to ~30 minutes, fully searchable.
Tests
test_fan_out_ingests_every_file_of_a_multi_file_manifest— a 6-file / 6-type manifest at concurrency 4: every resource stored, counts complete, one receipt per type.--features postgres.