PHP Amazon S3 上传速度
我正在使用 PHP Amazon S3 类(似乎是强烈推荐和广泛使用的),并且发现与使用命令行 s3cmd 实用程序。
例如,相同的 20mb 文件通过 s3cmd 需要 2.8 秒,通过 php 需要大约 54 秒:
Command Line:
s3cmd put archive.tar.gz s3://bucket
Output: File 'archive.tar.gz' storage as s3://bucket/archive.tar.gz (23320623 2.8 秒内的字节,8.07 MB/s) [1 of 1]
PHP:
$time = time();
$s3 = new S3('ACCESS KEY','SECRET KEY');
$s3->putObjectFile('archive.tar.gz','bucket','archive.tar.gz');
echo 'Done in '.(time()-$time).' seconds';
输出:在 54 秒内完成
如果使用 PHP 上传到 S3,这是否只是我必须接受的事情?或者有没有更好的方法来做到这一点,我错过了?我只是不明白为什么上传速度会存在如此巨大的差异,并且由于我将来需要对更大的文件执行此操作,因此这种缓慢的速度将是有问题的。
I am using a PHP Amazon S3 Class (which seems to be highly recommended and widely used) and have found that the speed of a file upload is extremely slow compared to if I use the command line s3cmd utility.
For example, the same 20mb file took 2.8 seconds via s3cmd and around 54 seconds via php:
Command Line:
s3cmd put archive.tar.gz s3://bucket
Output: File 'archive.tar.gz' stored as s3://bucket/archive.tar.gz (23320623 bytes in 2.8 seconds, 8.07 MB/s) [1 of 1]
PHP:
$time = time();
$s3 = new S3('ACCESS KEY','SECRET KEY');
$s3->putObjectFile('archive.tar.gz','bucket','archive.tar.gz');
echo 'Done in '.(time()-$time).' seconds';
Output: Done in 54 seconds
Is this just something I have to accept if using PHP to upload to S3? Or is there a better way of doing this that I'm missing? I just can't see why there would be such a huge discrepancy in the upload speed and as I need to do this with much bigger files in the future, such slowness is going to be problematic.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
禁用 SSL!
现在它正在快速前进。
Disable SSL!
And now it is speeeeeeding along.