Updated on 2024-01-16 GMT+08:00

Multipart Upload Overview (SDK for Java)

Function

You can upload large files using multipart upload. Multipart upload is applicable to many scenarios, including:

  • Files to be uploaded are larger than 100 MB.
  • The network condition is poor. Connection to the OBS server is constantly down.
  • Sizes of files to be uploaded are uncertain.

A multipart upload has the following advantages:

  • Higher throughput: You can upload parts in parallel to improve throughput.
  • Quick recovery from network failures: Uploading an object in parts helps minimize the impact of upload interruptions caused by network failures.
  • Flexible suspension and resumption of object uploads: You can upload parts at any time. A multipart upload will not expire after being initiated. You must explicitly complete or abort a multipart upload.
  • No need to know the size before uploading an object: You can upload an object while creating it.

A multipart upload consists of the following steps:

  1. Initiate a multipart upload (ObsClient.initiateMultipartUpload).
  2. Upload parts one by one or concurrently (ObsClient.uploadPart).
  3. Assemble parts (ObsClient.completeMultipartUpload) or abort the multipart upload (ObsClient.abortMultipartUpload).