We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

Ivan_Gusev's avatar
Ivan_Gusev
Explorer | Level 3
8 years ago

Official Dropbox .Net v2 SDK, slow uploading speed for large files

Hello,

We use Official Dropbox .Net v2 SDK.

Average uploading speed for some our clients is 50-100 kb/sec.

We use the following code to upload chunks

 

 

log.Trace("{0}. File chunk taken. CountBytes: \"{1}\"", nameof(UploadFileImpl), countBytes);
using (var memStream = new MemoryStream(buffer.Take(countBytes).ToArray()))
{
    using (var t = dropBoxClient.Files.UploadSessionAppendV2Async(new UploadSessionCursor(sessionId, offset), false,memStream))
    {
        t.Wait();
    }
}
 
offset += (ulong) countBytes;
log.Trace("{0}. File chunk uploaded. Offset: \"{1}\"", nameof(UploadFileImpl), offset);

 

In client's log we can see the following record:

 

 

2017-11-16 12:01:43.3748|UploadFileImpl. File chunk taken. CountBytes: "2097152"
2017-11-16 12:02:21.7800|UploadFileImpl. File chunk uploaded. Offset: "3909091328"

 

Uploaded 2mb in 40 sec. ~ 50 kb/sec

 

Any ideas?

 

PS. Client's internet connection is 5-20 mb/sec.

 

  • Greg-DB's avatar
    Greg-DB
    7 years ago

    The web site uses a somewhat different piece of infrastructure than the API, so that may not be a good comparison.

     

    If you want to test your connection to the Dropbox API content servers directly though, you can test a simpler /2/files/upload API call, e.g., using curl:

     

    https://www.dropbox.com/developers/documentation/http/documentation#files-upload

     

    That would eliminate the complexity of using upload sessions, and let you see what kind of speeds you're getting for a single connection.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff
    First, note that the connection speed will vary from place to place. Your connection speed to Dropbox depends on the routing you get between your ISP and our servers, and may be slower than your ISP's rated speeds.

    Sometimes resetting or retrying your connection gets you a different route and better speeds, but that is outside of our control. Some ISPs also throttle sustained connections so if you see an initial high connection speed followed by lower speeds, that could be the reason.

    Also, I see from the output though that it appears you're using about 2 MB chunks. I recommend using a larger chunk size, such as 8 MB or 16 MB (or even higher, depending on the connection). Using a larger chunk size can increase the overall speed by reducing the number of individual HTTPS requests needed, reducing overhead. It does come at the cost of having to resend more data when any one particular request fails though.
    • Ivan_Gusev's avatar
      Ivan_Gusev
      Explorer | Level 3

      That is all clear, thanks.

      But speed is 50 kb/sec...

      How can we test the uploading speed to find the error? Should we upload a file via browser and check if the uploading speed is equal?

      P.S.

      We use a dynamic chunk size. If we receive a timeout error then we start to upload from the beginning with reduced chunk size. By default we upload chunk size = 8 mb.

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        The web site uses a somewhat different piece of infrastructure than the API, so that may not be a good comparison.

         

        If you want to test your connection to the Dropbox API content servers directly though, you can test a simpler /2/files/upload API call, e.g., using curl:

         

        https://www.dropbox.com/developers/documentation/http/documentation#files-upload

         

        That would eliminate the complexity of using upload sessions, and let you see what kind of speeds you're getting for a single connection.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 6 hours ago
325 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!