使用 Apache HttpClient 上传 2GB 文件

Upload 2GB file with Apache HttpClient

我是 Apache HC 的新手,我想知道上传大约 1 或 2 GB 文件的最佳方式是什么。

我正在使用 Minio SDK 从服务器检索预签名 url。之后,我将这个预签名 url 发送到将上传指定文件的客户端。

从 Minio 端来看,每个 put 操作的最大大小为 5GiB,因此从 minio 端来看应该没有问题。我主要担心的是:

从 Apache HC 上传文件以获得最佳性能/不易出错的行为的最佳方式是什么?

我猜直接上传一个2GB的文件不是一个好的选择。如果发生错误,Apache HttpClient 是否会处理上传?分块上传文件方便吗?我该如何实现?

From Minio side, the max size per put operation is 5GiB so there should be no problems from minio side. My main concern is:

What would be the best way to achieve the upload of the file from Apache HC in order to get the best performance / less error prone behaviour?

I'm guessing that directly uploading a 2GB file is not a good option. Does the Apache HttpClient handles that upload in case an error occur? Is it convenient to upload the file as parts? How do I achieve that?

Minio 服务器将每个 PutObject 的最大大小更改为 16GiB。 Apache 客户端应该可以毫无问题地处理高达 2GiB 的上传。