b2-sdk-php icon indicating copy to clipboard operation
b2-sdk-php copied to clipboard

Uploads are slow / request to benchmark uploads

Open OscarEriksen opened this issue 8 years ago • 5 comments

Hi,

We have a platform where we usually upload up to 50 files from a user (images), where each upload can take up to 20 seconds for an image of 2MB. We have found that the uploads are extremely slow in regards of this. I was in contact with Backblaze B2-support and they suggested maybe it has something to do with HTTPS-verification or such things.

I will try to create an isolated test-case, but until then - do you have any thoughts on this? Is it a mis-configured server on our end; or are uploads typically these slow?

OscarEriksen avatar Mar 02 '18 08:03 OscarEriksen

This library uses Guzzle, which internally uses cURL, so I imagine any slowness would be down to something on your end - a misconfigured server, a slow connection to Backblaze's data center or similar.

If you can provide a reliable test case I can certainly try it on my end.

cwhite92 avatar Mar 02 '18 11:03 cwhite92

Thanks for a prompt reply! We're running on Linode. I will do some benchmarking and a test case from different providers and get back to you.

OscarEriksen avatar Mar 02 '18 11:03 OscarEriksen

Try running an upload using blackfire. If all time is spend in the curl call, it might be network related rather than code related.

iammichiel avatar Mar 14 '18 08:03 iammichiel

Backblaze generally recommends uploading in parallell or on multiple threads, and has their datacenters in the US for now only. That is probably the reason. I'll get back to you with a blackfire log.

OscarEriksen avatar Mar 15 '18 17:03 OscarEriksen

Hm. They recommend using parallel upload given a certain filesize. I can confirm however that there is a 200/300ms latency for each roundtrip from Europe. If you don't have a cached authorization token, that can be up to 3 trips before you even start uploading.

  1. Getting the Authorization token
  2. Checking the file does not exist
  3. Getting the upload Token
  4. Start uploading

And only then, start the uploading. A blackfire profile would be cool to go a little further indeed ;)

iammichiel avatar Mar 16 '18 08:03 iammichiel