Stream multipart UploadPart on Workers (avoid buffering parts in WASM memory)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 68/100
Research direction
Read crates/cf-workers/src/backend.rs, comparing send_raw with the forward template, then trace execute_multipart and the NeedsBody arm in crates/core/src/proxy.rs. Follow S3RequestSigner for presigning query parameters; done means UploadPart streams through Forward without WASM body buffering or payload hashing while the other multipart operations retain their stated behavior.
Written by the indexing model from the issue text.
Description
Problem
Multipart UploadPart flows through the NeedsBody → send_raw path, which buffers the entire part body in WASM linear memory on the Cloudflare Workers runtime:
collect_js_bodycopies the request stream JS→WASM (array_buffer()+to_vec())execute_multipartcomputes SHA256 over the whole part for the outbound signature (hash_payload)send_rawcopies WASM→JS (js_sys::Uint8Array::from) to hand tofetch
So each part incurs two full body copies across the JS/WASM boundary + an O(N) SHA256, and is held in the worker's 128 MB memory heap. Single-object PutObject does not have this problem — it uses the zero-copy forward() path (the ReadableStream is handed straight to fetch, signed with UNSIGNED-PAYLOAD so no hashing).
For typical part sizes (~8 MiB) this is a few ms of CPU and fine. But the 128 MB memory limit caps the maximum multipart_chunksize a client can use before the worker OOMs.
Proposed fix
Route UploadPart through the streaming forward() path instead of send_raw:
- Generate a presigned URL for
PUT /{key}?partNumber=N&uploadId=X.object_store'sSigner::signed_urlonly takes aPath(no query params), so presign manually viaS3RequestSigner— it already builds SigV4 canonical query strings (incl. value-less params, fixed in #88). - Return
HandlerAction::Forwardso theReadableStreamstreams straight throughfetch: no WASM buffering, no payload hash.
CompleteMultipartUpload stays on send_raw (its small XML body must be signed/forwarded), but that body is tiny. CreateMultipartUpload/AbortMultipartUpload are body-less and could also move to the forward path opportunistically.
Interaction with Cloudflare's request-body size limit
Even with streaming, every request through a Worker is bounded by the plan's request-body limit (100 MB Free/Pro, 200 MB Business, 500 MB Enterprise default). Streaming changes which limit binds:
- Today (buffered): a part is capped by the smaller of the 128 MB memory limit and the plan body limit.
- After streaming: a part is capped only by the plan body limit (no WASM buffering).
So streaming lets clients use the full plan body limit for part sizes. It does not lift the body limit itself — that's a hard platform constraint (see separate doc note). Large objects must still be uploaded as multipart with part sizes ≤ the plan limit.
Impact
- Removes the 128 MB part-size ceiling on Workers (raises it to the plan body limit).
- Eliminates 2 body copies + 1 SHA256 per part → lower CPU.
- Brings
UploadPartto parity with the zero-copyPutObjectpath.
References
crates/cf-workers/src/backend.rs—send_raw(buffers);forwardis the zero-copy templatecrates/core/src/proxy.rs—execute_multipart,dispatch_operation(theNeedsBodyarm)- Deferred from #88 to keep that PR scoped to correctness.
- Dominant language
- Rust
- Stars
- 21
- Forks
- 1
- Avg merge
- 16h 39m
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from developmentseed/multistore
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
developmentseed/multistore#160 ·
-
Support UploadPartCopy (multipart server-side copy): AWS CLI and boto3 use it for any copy over 8 MBOpenenhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
developmentseed/multistore#168 ·
-
List of a prefix 503s when a single object key contains an empty path segment (//)Possibly taken @alukach claimed this 127 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 55/100
developmentseed/multistore#116 · 1 comment ·
-
oidc-provider: optional `oidc_session_name` backend-option to override RoleSessionName derivationOpen
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Credential cache key (role ARN) doesn't capture the full minted identity (subject + extra_claims)Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
All issues in developmentseed/multistore
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
storytold/craft-anything#2472 ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsotto/sotto-authenticator#68 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
slavakurilyak/awesome-ai-agents#1046 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nowledge-co/hawdb#1995 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
swc-project/swc-next-issues#984 ·