Applicable Scenario
Multipart upload is suitable for uploading large objects in poor or high-bandwidth network environments. The Cloud Object Storage (COS) console and SDKs help you split a single object into parts and upload them. You can also split the object yourself and call the API to upload each part separately. Multipart upload has the following advantages:
- In a poor network environment, a smaller part size minimizes the impact of restarting a failed upload due to network errors.
- In a high-bandwidth environment, multipart upload can maximize the use of your available bandwidth by uploading object parts in parallel. Uploading parts out of order does not affect the final merged object.
- Using multipart uploading, you can pause and resume uploading a single large object at any time. With multipart upload, you can pause and resume the upload of a single large object at any time. All incomplete multipart uploads can be resumed unless aborted.
- Multipart upload can also be used to begin an upload before you know the final object size. You can initiate an upload and then merge the parts to get the full object size.
When uploaded, these parts are numbered consecutively. You can upload each part separately or upload all the parts in any order. Eventually, COS will merge them into the object based on the order of the part numbers. If the transmission of any part fails, the failed part can be transmitted again without affecting other parts or the content as a whole. Generally, in a poor network environment, multipart upload is recommended for objects larger than 20 MB. In a high-bandwidth environment, multipart upload can be used to upload objects larger than 100 MB.
Usage Instructions
Using the REST API
You can use the REST API directly to initiate a multipart upload request. For more information, see the following API documentation:
- Initiate Multipart Upload
- Complete Multipart Upload
- Upload Part
- Abort Multipart Upload
Using Java SDKs
COS supports AWS Java SDK. See Using AWS S3 SDK to Access COS to access COS, and operate according to the PUT Object section in the official documentation of AWS Java SDK 2.20.0.