Skip to content

reduce the multipart part size on the opendal backends - #6779

Open
DeviousCardi wants to merge 1 commit into
quickwit-oss:mainfrom
DeviousCardi:fix/6494-opendal-part-size
Open

reduce the multipart part size on the opendal backends#6779
DeviousCardi wants to merge 1 commit into
quickwit-oss:mainfrom
DeviousCardi:fix/6494-opendal-part-size

Conversation

@DeviousCardi

Copy link
Copy Markdown

Description

Closes #6494.

OpendalStorage::put passes the multipart part size to writer_with(..).chunk(..), and OpenDAL buffers a whole chunk before flushing it. The part size is therefore also the peak amount of memory a single upload holds. At the shared MultiPartPolicy::default() target of 5 GiB, a large split is uploaded as one part and stays in memory in full.

The S3 implementation does not have this exposure: upload_part builds each part with payload.range_byte_stream(part.range), so the part is streamed from the payload and never held. There, a larger part only means fewer parts and so fewer billed PUT requests.

Because the two backends pay different prices for the same setting, this lowers the part size for the OpenDAL backends alone rather than changing MultiPartPolicy::default(). Changing the shared default would increase PUT request costs on S3 without saving any memory there.

The other limits are left as they are, since they describe what the backend accepts rather than how much is buffered.

How was this PR tested?

Three unit tests in opendal_storage::base:

  • opendal_policy_bounds_the_part_size — a 4 GiB split is a single 5 GiB part under the shared default and 1 GiB parts under the OpenDAL policy.
  • opendal_policy_keeps_the_other_limits — threshold, maximum part count, maximum object size and upload concurrency still match the default.
  • opendal_policy_leaves_small_uploads_single_part — an upload below the multipart threshold is still sent whole.
cargo test --workspace --features quickwit-storage/gcs --lib opendal_storage
  test result: ok. 10 passed; 0 failed

make fmt is clean.

One thing worth a maintainer's opinion: 1 GiB is the value suggested on the issue. It bounds an upload to a fifth of what it could previously hold while keeping the request count low, but if you would rather trade more PUT requests for a smaller ceiling, the constant is the only thing that needs to change.


Generated with Claude Opus 5, then reviewed and tested locally before submission.

OpenDAL buffers a whole part before flushing it, so the target part size is also
the peak memory a single upload holds. At the shared default of 5 GiB a large
split is sent as one part and resides in memory in full.

The S3 implementation streams each part straight from the payload, so a larger
part there only buys fewer billed PUT requests and costs no memory. Lower the
part size for the OpenDAL backends alone rather than the shared default, which
would raise S3 request costs for no benefit.
@DeviousCardi
DeviousCardi requested a review from a team as a code owner September 8, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce part size on Google Storage / Opendal

1 participant