fix(data): bound backfill concurrency - #169
Merged
Merged
Conversation
Owner
|
Thanks @Faysk for the thoughtful fix and the detailed benchmarks! The cancellation handling and focused regression tests are especially helpful. I reviewed the changes and ran the five new admission tests plus the existing backfill router/API tests locally: all 27 passed, and Ruff passed for the changed Python files. I found no blocking issues in the review. I have approved the pending CI workflow for this fork PR so the full checks can run before merging. Thanks again for contributing to Inalpha! |
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.
Summary
Fixes #107.
/backfill/barsupstream fetch concurrency to 8 per data worker by default;Why
Under sustained concurrent factor and live-runner traffic,
/backfill/barscould hold PostgreSQL pool leases across provider I/O. Releasing those leases removed the DB-starvation mechanism, but also exposed excessive upstream provider fan-out.A process-local admission gate keeps provider concurrency bounded while leaving database connections available for short DB operations.
Validation
Controlled issue-107 benchmarks and topology tests showed:
Focused regression coverage verifies:
Operational note
BACKFILL_MAX_CONCURRENCYis process-local and defaults to8. Set it to0to disable the gate. Production currently runs two data workers, so the container-wide provider peak can be roughly twice the configured per-worker value.Known follow-up
Concurrent same-key backfills can still duplicate provider work and complete writes out of order. That behavior predates this fix and is intentionally left out of #107 to avoid expanding the saturation fix into cross-worker single-flight/write-order coordination.