Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MinIO Java SDK is much slower compared to both mc and AWS S3 Java SDK #1332

Closed
arman-yekkehkhani opened this issue May 23, 2022 · 8 comments · Fixed by #1333
Closed

MinIO Java SDK is much slower compared to both mc and AWS S3 Java SDK #1332

arman-yekkehkhani opened this issue May 23, 2022 · 8 comments · Fixed by #1333

Comments

@arman-yekkehkhani
Copy link

I am using Java 8 and trying to upload a 1 Gb file on a local MinIO server. Here is the amount of time it took for each of the following methods:

MinIO Java SDK: 17s
AWS Java SDK: 11s
AWS Java SDK(with Transfer Manager): 7s
mc client: 3.5s

I wonder what makes MinIO SDK slower and how can I improve the speed.

@balamurugana
Copy link
Member

How are you trying to upload?

@arman-yekkehkhani
Copy link
Author

Using MinIO SDK:

minioClient.uploadObject(
        UploadObjectArgs.builder()
        .bucket("test_bucket")
        .object("test")
        .filename("/path_to_some_file")
        .build()
);

Using S3 SDK:

TransferManager tm = TransferManagerBuilder.standard()
         .withS3Client(s3Client)
         .build();

Upload upload = tm.upload("test_bucket", "test", file);
upload.waitForCompletion();

mc:

./mc cp {file_path} {bucket_path}

@balamurugana
Copy link
Member

balamurugana commented May 23, 2022

Use part size using this UploadObjectArgs.Builder.filename() and tweak part size value as per your requirement.

@arman-yekkehkhani
Copy link
Author

Tried different values: 5Mb, 10Mb, 30Mb, 50Mb, 100Mb, and 1Gb. Same or even worse performance.

@balamurugana
Copy link
Member

How was MinioClient created? Are you running mc and minio-java on same machine?

@arman-yekkehkhani
Copy link
Author

Here is the code:

MinioClient minioClient =
                    MinioClient.builder()
                            .endpoint("http://127.0.0.1:9000")
                            .credentials("minioadmin", "minioadmin")
                            .build();

Yes. They are both on the same machine(my local machine).

@balamurugana
Copy link
Member

For 1GiB file upload, I see HTTP request/response takes 5 seconds and file read takes another 5 seconds.

@balamurugana
Copy link
Member

As expected, SHA256 and MD5 checksum calculation are slow. Probably I will move away from Java built-in SHA256/MD5 hasher.

@balamurugana balamurugana reopened this May 23, 2022
balamurugana added a commit to balamurugana/minio-java that referenced this issue May 23, 2022
Previously, `UNSIGNED-PAYLOAD` is sent sha256sum and computed md5sum
of body for HTTPS and computed sha256sum/md5sum of body for HTTP. This
made the API slower. Now computed sha256sum is always sent for both
HTTP and HTTPS.

Fixes minio#1332

Signed-off-by: Bala.FA <[email protected]>
harshavardhana pushed a commit that referenced this issue Jun 12, 2022
Previously, `UNSIGNED-PAYLOAD` is sent sha256sum and computed md5sum
of body for HTTPS and computed sha256sum/md5sum of body for HTTP. This
made the API slower. Now computed sha256sum is always sent for both
HTTP and HTTPS.

Fixes #1332

Signed-off-by: Bala.FA <[email protected]>
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 a pull request may close this issue.

2 participants