Repository navigation
perf(http): large documents are derived as they arrive - #288
Merged
Merged
Conversation
A derived read used to buffer the whole response on the engine side before its compaction ran, so one cold large repository peaked near 700 MB. Successful derived answers now stream decoded chunks through a bounded channel into the blocking derive worker, which parses each document with a reader (serde_json::Deserializer::from_reader, BufRead, serde_yaml_ng from_reader) instead of a slice. The request's host permit is held until its body is read, so in-flight bodies stay inside the per-host limit; buffered derives keep their own four-job bound. Derived outputs are byte-identical (a parity test runs every derive over every fixture body and the captured catalog documents under several chunkings), transcripts and cache semantics are unchanged, and statuses the loop inspects — redirects, throttles, retries, 304 — stay buffered. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Streaming derivation holds a host permit until its body is read, which serialises download and parse under one slot: at the old limit of 16 a cold grafana lost wall time even though peak RSS fell from ~680 MB to ~160 MB. Measured at 16, 32 and 64, 32 restores parity with the old wall (~13 s) at ~165 MB peak, and 64 buys nothing further. GitHub's client keeps its own governor. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | 1fbda9b | Commit Preview URL Branch Preview URL |
Nov 13 2026, 12:29 AM |
…t rises A token run sized GitHub's governor from the default host limit, so raising that to 32 doubled the CLI's GitHub concurrency. GitHub now takes its own host limit when one is set, otherwise the default capped at 16.
Merged
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.
Consult 7, PR 11. A cold lookup of a large repository held each registry document whole before deriving from it: npm packuments run to tens of megabytes (vite 39 MB, renovate 75 MB), and a cold grafana lookup peaked at about 700 MB. That peak is the first suspect for the memory growth in issue #193.
Streaming derivation
Transportgainssend_streaming, returning the status, headers and a body stream. Its default wraps a bufferedsendinto one chunk, so fakes and replay cassettes work unchanged; the network client streamsbytes_stream().conditional::derivefeeds chunks to its blocking worker through a bounded channel (four chunks) and parses withserde_json::Deserializer::from_readerplusend(), which rejects trailing content as before. The raw document is never held whole. EveryDerivedtransform reads fromio::Read: JSON Lines throughBufRead, YAML throughserde_yaml_ng::from_reader; the HTML-or-JSON sniffing transform buffers locally.Host limit 16 → 32. Holding a permit through the body read serialises a host at 16 (cold grafana about 16 s). At 32 wall time is back to today's and memory stays near 165 MB; 64 bought nothing more.
defaultHostConcurrencydefault,reference/settings.mdx,internals/cache.md. GitHub's API keeps its own cap: a CLI run uses theapi.github.comhost limit when set, otherwise the default capped at 16 (unchanged from before); the server keeps 4.Proof
derive_parity(datasource and notes) runs everyDerivedtransform over all 294 fixture bodies, whole and in 997-byte and tiny chunks: identical output. WithPATCHULA_PARITY_DOCSit also covers the four captured packuments ofbenchmarks:catalogs(vite, typescript, renovate, effect); identical in release mode.benchmarks:catalogsreplay digest is identical before and after.Measured (VM, musl release, cold cache, co-tenant load so wall times are conservative):
Known limits, not regressions: Helm indexes (YAML), the PyPI simple-index fallback and image digests still buffer their whole body, as before.