Start a new topic
Answered

Performance on file upload

Hello


Initially I've started uploading files into Kinveys backend environment using REST API. That always took me several seconds. I thought the problem might be caused by my backend server (doing the upload).

Now using your HTML5 API (3.1.2) I experience the same performance problem. The central upload operation is: 

var promise = Kinvey.Files.upload(fileContent, metaData)
      .then(function (file) {...

I have done some tests with a 5KB png file. I live in middle of Europe and use a 150MMBit Internet connection (50MBit upload). Further more I've tested on different browsers: Firefox, Chrome, Safari (all latest versions). 


If you have a look at the attached screenshot (browser network output):

image


As you can see it takes several seconds (twice) for www.googleapis.com that probably is invoked by the HTML5 Kinvey API. Based on different tests those calls take 2-8 seconds. The fourth one in the list is string upload into a collection which is always fast).


So my questions are: Do you (at Kinvey) experience the same time (several seconds) on uploading a very small file? Is this normal or are there options I can improve upload speed?


The funny thing: Having the Kinvey console opened in a separate tab I see the upload file there "right away" after upload start but it still takes several seconds the callback (.then(...) tells me the file was successfully uploaded.


Regards


Best Answer

Hi Tayger,


The relative slow upload to Google Cloud Storage is normal due to GCS's fixed latency cost per request that’s related to ensuring that the files are replicated and uploaded properly. So the actual upload of the file is a small portion compared to this fixed latency cost. That is why uploading a small file and a larger file can be similar in time.


As for the file appearing in the Kinvey console before you get the callback - the upload of the file is done in two steps - first the file metadata is saved in Kinvey and then the file itself is uploaded in GCS - the file metadata request to Kinvey is quite fast so that is why you see the file appear in Kinvey console, while the callback waits for the file to be uploaded to GCS before returning a response.


Let me know if this has helped.


Hi Martin

Yes, that helped, thank you! The process "behind the scene" is now clearer to me. I was guessing something like that since I see uploaded files/data very quickly. That confirms me as well that I'm not doing wrong anything. I used a small file to make sure the file size is not the problem but I'm a ware there is a lot more in the background than "just" a file will be uploaded.


Regards

Answer

Hi Tayger,


The relative slow upload to Google Cloud Storage is normal due to GCS's fixed latency cost per request that’s related to ensuring that the files are replicated and uploaded properly. So the actual upload of the file is a small portion compared to this fixed latency cost. That is why uploading a small file and a larger file can be similar in time.


As for the file appearing in the Kinvey console before you get the callback - the upload of the file is done in two steps - first the file metadata is saved in Kinvey and then the file itself is uploaded in GCS - the file metadata request to Kinvey is quite fast so that is why you see the file appear in Kinvey console, while the callback waits for the file to be uploaded to GCS before returning a response.


Let me know if this has helped.

Login or Signup to post a comment