feat(upload): Enable compression for forwarded uploads#5965
Open
feat(upload): Enable compression for forwarded uploads#5965
Conversation
Replace the hardcoded gzip encoder in `UploadRequest::build` with a dispatch over `config.http_encoding()`, so forwarded uploads can use deflate/brotli/zstd in addition to gzip. Fixes the `encode_body` helper to compile (proper stream bounds, boxed return type) and corrects a ZstdDecoder/Encoder typo. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This reverts commit f78c3a6.
jjbayer
commented
May 8, 2026
| # Keep it pinned until it's possible to disable backtrace. | ||
| anyhow = "=1.0.69" | ||
| arc-swap = "1" | ||
| async-compression = { version = "0.4", features = ["tokio", "gzip", "brotli", "deflate", "zstd"] } |
Member
Author
There was a problem hiding this comment.
This was already in our dependency tree.
jjbayer
commented
May 8, 2026
| kind: RequestKind::Upload { | ||
| location, | ||
| stream: Some(stream), | ||
| encoding: HttpEncoding::Zstd, |
Member
Author
There was a problem hiding this comment.
Suggested change
| encoding: HttpEncoding::Zstd, | |
| encoding: HttpEncoding::Zstd, // just a default, will be overwritten by .configure() |
loewenheim
requested changes
May 8, 2026
Comment on lines
+7
to
+10
| use async_compression::tokio::bufread::BrotliEncoder; | ||
| use async_compression::tokio::bufread::DeflateEncoder; | ||
| use async_compression::tokio::bufread::GzipEncoder; | ||
| use async_compression::tokio::bufread::ZstdEncoder; |
Contributor
There was a problem hiding this comment.
Suggested change
| use async_compression::tokio::bufread::BrotliEncoder; | |
| use async_compression::tokio::bufread::DeflateEncoder; | |
| use async_compression::tokio::bufread::GzipEncoder; | |
| use async_compression::tokio::bufread::ZstdEncoder; | |
| use async_compression::tokio::bufread::{BrotliEncoder, DeflateEncoder, GzipEncoder, ZstdEncoder}; |
Comment on lines
+32
to
+33
| use tokio_util::io::ReaderStream; | ||
| use tokio_util::io::StreamReader; |
Contributor
There was a problem hiding this comment.
Suggested change
| use tokio_util::io::ReaderStream; | |
| use tokio_util::io::StreamReader; | |
| use tokio_util::io::{ReaderStream, StreamReader}; |
Contributor
|
Sorry, I had some comments based on misunderstandings, but I deleted them. |
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.
Relay-to-Relay communication of upload streams did not use any compression. This PR makes it use the configured
http.encoding(defaults to zstd).This should be an overall win, but it should also remedy a specific case:
Content-Encoding: gzip).proxy_read_timeout.Next steps after this PR: potentially enable compression for uploads to objectstore as well.
ref: INGEST-901