Repository navigation
fix(sourcemap): Keep artifact bundles compressed at rest - #2546
Draft
sentry-junior[bot] wants to merge 1 commit into
Draft
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
Since the CLI started building STORED ZIPs whenever the server offers a wire codec, artifact bundles land in storage uncompressed: the server decodes the per-chunk zstd before saving the blobs, and the assembled bundle is stored as-is. Large Next.js uploads now store ~4x the bytes. Always DEFLATE each ZIP entry and send chunks with no wire codec. To keep this fast on 2-4 vCPU CI runners: - Compress entries in parallel on the libuv threadpool with an in-order writer, so the archive is byte-identical to sequential writes. The read-ahead is 16 entries per CPU, capped at 256 MiB. - Use zlib level 4 instead of 6: ~40% faster for ~4% larger output. - Write each entry and the central directory with one write call instead of 3 and 2 per entry. - Keep entry names as strings until finalize. Small Buffers are slices of Node's shared pool, which zlib also fills, so retaining one per entry pinned a 64 KiB slab each, about 1.2x the input in RSS. Co-Authored-By: Lorenzo <17258265+lcian@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
This branch was successfully deployed
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.
Artifact bundles that
sentry sourcemap uploadsends are stored uncompressed, about 4x larger than needed. The CLI now compresses each ZIP entry with DEFLATE and uploads the chunks with no wire codec.Since getsentry/cli#849, the CLI builds a STORED ZIP and compresses only the upload chunks with zstd. The Sentry chunk-upload endpoint decodes that zstd before it saves the blobs, so blobs and reassembled bundles go to blob storage without any compression at rest.
This moves the compression work from the upload into the ZIP build. This sends slightly more bytes, because DEFLATE compresses less than zstd. To keep large uploads fast on 2–4 vCPU runners,
ZipWriternow compresses entries in parallel at zlib level 4. This PR also fixes an existing bug by no longer holding entry names as small Buffers, which kept shared pool memory and made peak memory grow with the bundle size.Benchmark
103,662 files (2.0 GiB): real npm package code, minified with esbuild, each with an external sourcemap that includes
sourcesContent. Times cover ZIP build, chunk hashing and, for the current CLI, the per-chunk zstd encode.Caveats:
.nextoutput. All runs used one 4 vCPU Xeon sandbox with a warm page cache. The 2 vCPU rows pin the process to two cores withtaskset; they are not a real 2 vCPU runner.UV_THREADPOOL_SIZEis raised.via @lcian.
--
View Session [Sentry]