简体   繁体   English

PHP Amazon S3上传速度

[英]PHP Amazon S3 Upload Speed

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. 我正在使用PHP Amazon S3类 (这似乎是强烈推荐和广泛使用),并且发现与使用命令行s3cmd实用程序相比,文件上载速度极慢。

For example, the same 20mb file took 2.8 seconds via s3cmd and around 54 seconds via php: 例如,相同的20mb文件通过s3cmd花费2.8秒,通过php花费大约54秒:

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] 输出: 文件'archive.tar.gz'存储为s3://bucket/archive.tar.gz(23320623字节,2.8秒,8.07 MB / s)[1/1]

PHP: 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 输出: 在54秒内完成

Is this just something I have to accept if using PHP to upload to S3? 如果使用PHP上传到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. 我只是不明白为什么上传速度会出现如此巨大的差异,而且我需要在将来使用更大的文件来做这件事,这种缓慢会有问题。

Disable SSL! 禁用SSL!

$s3 = new S3('ACCESS KEY','SECRET KEY', false);

And now it is speeeeeeding along. 现在它正在进行中。

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

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