20

I'm trying to upload large (50 MB - 32 GB) files to Google.Drive. I'm using google-api-dotnet which provides upload logic and encryption support. The main problem is slow uploading speed.

I looked through api source code. Each file is uploaded by chunks (I set chunk size to 4 MB) Each chunk is uploaded via new HttpRequestMessage instance. HttpClient is created once the api service started and reused for all requests.

The upload speed is 600 kbytes/s and stable while my uplink is 10 times faster.

I captured traffic with Wireshark: slow-uploading-screenshot Each chunk is divided into hundreds or thousands small TLS packets. And for each small TLS packed a confirmation is expected. So the resulting speed is very low.

But when I start Fiddler proxy, the speed becomes as fast as my uplink can do. The TLS packets going very fast in parallel and the confirmations are received later: tls-packets-first-screenshot tcp-ack-later

I tried my code on 5 PC's with Win7 and all showed similar low uploading speed. But when I tried on Win10 PC - the speed was very good. Also I tried Google.Drive client application and it had same problems with speed. I tried to search about this behaviour, but I didn't found anything.

  1. Why are 4 MB chunks divided into 4 KB TLS packets? Can I increase TLS packets size?
  2. How can I make the TLS packets sending in parallel as Fiddler does?
  3. Or is there other methods of increasing upload speed?
Ivan Peresedov
  • 201
  • 1
  • 7
  • I wonder if this is a variant of the problem described at https://ask.wireshark.org/questions/38768/slow-upload-speed-from-windows-stations-to-ssl-hosts which some software (Fiddler) is working around, but your use of HttpClient is not. – Jon Hanna Nov 24 '15 at 12:37
  • I would give a try to https://github.com/Redth/HttpTwo – Botond Botos Nov 08 '16 at 17:30
  • I am facing same problem. Did you found any work around for this issue? – Mayuresh Aug 30 '17 at 12:21

2 Answers2

1

It is highly possible that the problem is the google link, not anything else. I have been uploaded things to google drive with chrome and besides my upload link is giant (50mbps up), google seems limited.

user7358693
  • 503
  • 2
  • 3
0

The maximum record size is 16kB for SSLv3/TLSv1 so maybe you handshake with older version. I think google is optimized to user SPDY / HTTP2 protocole that can send in parallel in the same connection. Maybe your client not...

How to make the .net HttpClient use http 2.0?

Community
  • 1
  • 1
Mr_Thorynque
  • 1,749
  • 1
  • 20
  • 31