perf(import): faster, steadier imports — hedged fast-fail STATs, warmed first articles, dead-post fast path - #941
Merged
Conversation
…2 s attempt ceiling The release probe STATs up to 64 sampled articles in one attempt whose deadline is capped at 2 s. When all but one or two answer in ~150 ms and the rest sit queued behind the concurrent first-segment warm-up on the same connections, the attempt ran to the full 2 s before the stragglers were retried, adding ~2 s to the import of every affected release. Once 90% of a sweep has reported, the remaining ids are re-issued on a second StatMany after a short grace derived from the observed median latency; the first answer per id wins and both sweeps stop as soon as every id is in. Attempt accounting, inconclusive/dead-release verdicts and cancellation are unchanged.
The probe gave up after exactly three 2 s attempts regardless of what the provider was doing. When STATs were slow but arriving (46 → 31 → 15 unanswered across the three attempts, right after a run of dead-release sweeps had the provider crawling through 430 lookups) a healthy release was refused as inconclusive. Retries now continue for as long as each attempt shrinks the unanswered set, within a 15 s wall-clock budget; an attempt at or past the third that makes no progress still ends the sweep, so a stuck provider costs what it did before. The retry backoff is clamped at 400 ms instead of doubling without bound.
4 tasks
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
Import-latency and robustness work driven by the nzb-streaming-benchmarks harness, run head-to-head against AIOStreams on the same corpus in the same session. Nine small commits, each TDD'd:
Fast-fail probe (
internal/importer/validation)Priority: true. Debug logs record hedge decisions and answers.bugonia2–5 s, once inconclusive; a damaged-not-dead set swept for 18 s). After: dead posts fail in 2.6–8 s and the 7z imports right after them take 0.6–0.8 s.Cold open / import critical path
cache_path); cold TTFB 55 → 3–10 ms. Also warm the largest clean-named video (previously skipped) when a store is wired.Observability (
internal/webdav)http.ServeContentswallows the reader's error. Client cancels are excluded.Results (same-session, AIOStreams vs AltMount, 9 shared entries, several passes)
The back-to-back dead posts no longer slow the imports that follow them. Remaining per-entry differences are within the harness's own stated run-to-run noise; in the evening's cleanest pass click→byte was 1.10 s vs 1.03 s.
Test plan
go test -race ./...green; new tests:fast_fail_hedge_test.go,fast_fail_patience_test.go,fast_fail_deadwave_test.go,segment_cache_fallback_test.go,parser_warm_store_test.go,adapter_get_test.gogo build ./... && go vet ./...golangci-lint(local lint is broken against Go 1.27 export data)