perf: stream proxied artifacts instead of buffering the full body in memory #94
Reference in New Issue
Block a user
Delete Branch "benvin/stream-immutable-blobs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #66
Why
fetchFromUpstreamread every upstream response withio.ReadAll, hashed it in memory, uploaded from memory and served from memory. A single large immutable blob (Docker layer, RPM, tarball, Go module zip) — or several concurrent ones — could OOM the process. The streaming, tempfile-backed CAS already existed but the proxy path bypassed it (andEngine.caswas assigned but unused).Changes
CAS.Store(tempfile -> sha256 -> S3), so memory stays bounded regardless of artifact size, and are served back from the store.RewriteResponse).RewriteResponsefor immutable content is behaviour-preserving: the proxy path always passes an emptyproxyBaseURL, under which every providersRewriteResponseis a no-op.sha256Hashhelper.Validation
make e2epasses.X-Artifact-Source: remote, fetch #2X-Artifact-Source: cache, both byte-identical (sha256) to the origin.