简体   繁体   English

为什么 amazon s3 cli 复制比 java sdk 在同一个桶中复制快得多?

[英]Why amazon s3 cli copy much faster than java sdk in the same bucket?

I have a file in s3 bucket say like s3://prefix/file1 with size 2G I tried to copy it to s3://prefix/file2我在 s3 存储桶中有一个文件,比如s3://prefix/file1大小为 2G 我试图将它复制到s3://prefix/file2

The CLI I used is aws s3 cp s3://prefix/file1 s3://prefix/file2我使用的 CLI 是aws s3 cp s3://prefix/file1 s3://prefix/file2

The sdk usage is amazonS3.copyObject("prefix","file1","prefix", "file2") sdk 用法是amazonS3.copyObject("prefix","file1","prefix", "file2")

CLI method took ~15s while sdk method took ~30s. CLI 方法耗时约 15 秒,而 sdk 方法耗时约 30 秒。

Try to use the TransferManager, like in this "old" blog post of AWS: https://aws.amazon.com/de/blogs/developer/using-transfer-manager-to-copy-amazon-s3-objects/尝试使用 TransferManager,就像 AWS 的这篇“旧”博客文章中那样: https://aws.amazon.com/de/blogs/developer/using-transfer-manager-to-copy-amazon-s3-objects/

I'm not very familiar with JAVA programming, but in several applications I've been involved in migrating/optimizing, switching from the "normal" SDK methods to operations using TransferManager with Java has sometimes helped improve performance.我不是很熟悉 JAVA 编程,但在几个应用程序中我参与了迁移/优化,从“正常”SDK 方法切换到使用 TransferManager 和 Java 的操作有时有助于提高性能。

Maybe this could also improve the performance for you.也许这也可以为您提高性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM