Skip to content

Commit 81ece1c

Browse files
perf(preprod): Use zstd for zip compression (#3038)
Noticed uploading a certain customer's build took 5+ minutes and upon further inspection the zipping was the lions share of that time. If we take away the actual network transport of the upload: - With level 6 compression: 5 minutes -> ultimately 566MB - with level 1 compression: 2.5 min -> ultimately 658MB - with zstandard: 36s -> ultimately 533MB What's more, we can support both types of compression on the Sentry backend, so this seems like a free (and significant) win
1 parent 9988dba commit 81ece1c

6 files changed

Lines changed: 13 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Performance Improvements
6+
7+
- We switch to a faster compression algorithm (zstd) for uploading size analysis builds (`sentry build upload`) in preparation for this week's beta release! ([#3038](https://github.com/getsentry/sentry-cli/pull/3038))
8+
39
## 3.0.0
410

511
### New Sentry Support Policy

src/commands/build/upload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ fn normalize_file(
563563
// This is important as an optimization to avoid re-uploading the same chunks if they're already on the server
564564
// but the last modified time being different will cause checksums to be different.
565565
let options = SimpleFileOptions::default()
566-
.compression_method(zip::CompressionMethod::Stored)
566+
.compression_method(zip::CompressionMethod::Zstd)
567567
.last_modified_time(DateTime::default());
568568

569569
zip.start_file(file_name, options)?;

src/utils/build/normalize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn add_entries_to_zip(
5555
// This is important as an optimization to avoid re-uploading the same chunks if they're already on the server
5656
// but the last modified time being different will cause checksums to be different.
5757
let options = SimpleFileOptions::default()
58-
.compression_method(zip::CompressionMethod::Deflated)
58+
.compression_method(zip::CompressionMethod::Zstd)
5959
.last_modified_time(DateTime::default());
6060

6161
for (entry_path, relative_path) in entries {
@@ -88,7 +88,7 @@ fn add_entries_to_zip(
8888

8989
fn metadata_file_options() -> SimpleFileOptions {
9090
SimpleFileOptions::default()
91-
.compression_method(zip::CompressionMethod::Deflated)
91+
.compression_method(zip::CompressionMethod::Zstd)
9292
.last_modified_time(DateTime::default())
9393
}
9494

tests/integration/_cases/build/build-upload-ipa.trycmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
$ sentry-cli build upload tests/integration/_fixtures/build/ipa.ipa --head-sha deadbeef12345678deadbeef12345678deadbeef
33
? success
44
> Preparing for upload completed in [..]
5+
> Uploading completed in [..]
56
Successfully uploaded 1 file to Sentry
6-
- tests/integration/_fixtures/build/ipa.ipa (http[..]/wat-org/preprod/wat-project/some-text-id)
7+
- tests/integration/_fixtures/build/ipa.ipa (http://sentry.io/wat-org/preprod/wat-project/some-text-id)
78

89
```
6 Bytes
Binary file not shown.

tests/integration/build/upload.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn command_build_upload_apk_chunked() {
167167
if is_first_assemble_call.swap(false, Ordering::Relaxed) {
168168
r#"{
169169
"state": "created",
170-
"missingChunks": ["60863d91bb673a1b1b92dbbe91b1de5cc0dde146"]
170+
"missingChunks": ["7138c09b474a5c84ac60e1b145855bf6dcc88913"]
171171
}"#
172172
} else {
173173
r#"{
@@ -224,7 +224,7 @@ fn command_build_upload_ipa_chunked() {
224224
if is_first_assemble_call.swap(false, Ordering::Relaxed) {
225225
r#"{
226226
"state": "created",
227-
"missingChunks": ["ed9da71e3688261875db21b266da84ffe004a8a4"]
227+
"missingChunks": ["1f168f404b360494fd1adbafaf920a303d1b3691"]
228228
}"#
229229
} else {
230230
r#"{

0 commit comments

Comments
 (0)