fix(proxy): stream requests#771
Merged
Merged
Conversation
basically allows us to funnel the data into a buffer for later usage
completion signal from `tee_body` allows us to then process in a separate task without compromising performance
c7d4d75 to
31c615a
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves the Lambda Runtime Proxy by implementing streaming requests instead of collecting entire request bodies before forwarding, addressing performance issues with Lambda's new 200MB payload limit.
- Introduces a TeeBodyWithCompletion struct that streams body data while capturing it for interceptor processing
- Refactors proxy handlers to use streaming requests instead of blocking body collection
- Updates dependencies to support the new streaming architecture
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
bottlecap/src/proxy/tee_body.rs |
New streaming body wrapper that tees data into buffer while forwarding |
bottlecap/src/proxy/mod.rs |
Adds tee_body module declaration |
bottlecap/src/proxy/interceptor.rs |
Refactors proxy handlers to use streaming with TeeBodyWithCompletion |
bottlecap/LICENSE-3rdparty.csv |
Removes duplicate dependency entries |
bottlecap/Cargo.toml |
Updates http-body, hyper-util, and tokio dependencies |
also added safety docs on unsafe pin
astuyve
approved these changes
Aug 4, 2025
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.
What?
Improves the Lambda Runtime Proxy by streaming requests, as opposed to collecting the whole body which blocks the runtime.
Why?
Lambda just increased outgoing payloads to 200MB – and I wanted to ensure we could improve our proxy here. I realized this could be improved bc of #768