my tests upload to box





在 2018-01-04 07:04:38,"Ray Satiro via curl-library" <[email protected]> 
写道:
On 1/3/2018 3:22 AM, tanjj1990 wrote:

  I've googled it before I send this message,but I did'n get the way out.


  Here are some tests. May these tests are not  rigorous, but they can show you 
my question: 
    why can't I get the speed like chrome without proxy set? 


  file size : 93582KB


  Box : https://app.box.com/folder/0


  operating system
     windows server 2008 R2 standard


  Test1:
  
  libcurl 
    compiler: vc=8
    version: 7.57.0
    openssl: 1.0.2n
    zlib: 1.2.11


  case1:
  upload the file to Box, with libcurl: the speed is about 350KB/s;
  I tried the CURL_MAX_WRITE_SIZE: 16384, 32768, 65536, 131072, 262144, 524288, 
1048576


  case2:
  upload the file to Box, with libcurl, set proxy http://127.0.0.1:3213 : the 
acerage speed is about 6MB/s;


  case3:
  upload the file to Box, with chrome, no proxy : the speed is about 6MB/s
  
--------------------------------------------------------------------------------------------------------------------------------


  Test2:


  libcurl-command-line: 
  upload the file to  http://speedtest.tele2.net


  ~~~~~~~~~~~~~~~~~~~ 
\Desktop\libcurl-vc8-x86-release-dll-ssl-dll-zlib-dll-ipv6\
  bin>curl -X POST --proxy http://127.0.0.1:3213  http://speedtest.tele2.net 
--dat
  a-binary @Server.exe -o result.txt
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  
Current
                                                         Dload  Upload   Total  
 Spent    Left  Speed
   100 91.3M    0  8140  100 91.3M    508  5848k  0:00:16  0:00:16 --:--:-- 
10.8M


   ~~~~~~~~~~~~~~~~~~~ 
\Desktop\libcurl-vc8-x86-release-dll-ssl-dll-zlib-dll-ipv6\
  bin>curl -X POST  http://speedtest.tele2.net --data-binary @Server.exe -o resu
  lt.txt
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  
Current
                                              Dload  Upload   Total   Spent    
Left  Speed
  100 91.3M    0  8141  100 91.3M     30   355k  0:04:23  0:04:23 --:--:--  345k
  
--------------------------------------------------------------------------------------------------------------------------------------


  Test3:


  curl: download from https://curl.haxx.se/download.html 
    version: Win64 x86_64 7zip7.57.0binarySSLSSHViktor Szakáts1.88 MB


  the speed upload to Box is same as libcurl;


  other cases: upload the file to  http://speedtest.tele2.net


  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\curl-7.57.0-win64-mingw\curl-7.57.0-wi
  n64-mingw\bin>curl -X POST --proxy http://127.0.0.1:3213  
http://speedtest.tele2
  .net --data-binary @ABServer.exe -o result.txt
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  
Current
                                                          Dload  Upload   Total 
  Spent    Left  Speed
   100 91.3M    0  8140  100 91.3M    542  6238k  0:00:15  0:00:15 --:--:-- 
11.6M


  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~curl-7.57.0-win64-mingw\curl-7.57.0-wi
  n64-mingw\bin>curl -X POST  http://speedtest.tele2.net --data-binary 
@ABServer.e
  xe -o result.txt
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  
Current
                                                         Dload  Upload   Total  
 Spent    Left  Speed
  100 91.3M    0  8141  100 91.3M     29   335k  0:04:39  0:04:39 --:--:--  317k
--------------------------------------------------------------------------------------------------------------------------------------------------

That's weird, I don't know what could be causing it. Does Chrome use the proxy? 
Can you try this PostUpload test [1] with and without the proxy?

[1]: https://gist.github.com/jay/daac01682f17c2dc213e

---------------------------------------------------------------------------------------------------
upload to box - chrome - no proxy

50MB in 6.41sec
50MB in 6.67sec
50MB in 5.78sec
50MB in 6.20sec
50MB in 6.38sec

---------------------------------------------------------------------------------------------------
upload to box - chrome - proxy set

50MB in 8.54sec
50MB in 7.58sec
50MB in 5.87sec
50MB in 9.00sec
50MB in 6.48sec


---------------------------------------------------------------------------------------------------
upload to box - curl download from https://curl.haxx.se/download.html#Win64 - 
no proxy

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\curl-7.57.0-wi
n64-mingw\bin>curl https://upload.box.com/api/2.0/files/content -H "Authorizatio
n:Bearer access~~~~~~~~~~~~~~~~~~~~~~~~~~" -X POST -F attributes="{\"name\":\"ul
speedtest\",\"parent\":{\"id\":\"0\"}}" -F file=@ulspeedtest -o result.txt

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 50.0M  100  1058  100 50.0M      6   314k  0:02:56  0:02:43  0:00:13  271k

100 50.0M  100  1058  100 50.0M      6   316k  0:02:56  0:02:42  0:00:14  271k

100 50.0M  100  1058  100 50.0M      6   320k  0:02:56  0:02:40  0:00:16  265k

100 50.0M  100  1058  100 50.0M      7   365k  0:02:31  0:02:20  0:00:11  314k

100 50.0M  100  1058  100 50.0M      7   360k  0:02:31  0:02:22  0:00:09  272k


---------------------------------------------------------------------------------------------------
upload to box - curl download from https://curl.haxx.se/download.html#Win64 - 
proxy set


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\curl-7.57.0-wi
n64-mingw\bin>curl https://upload.box.com/api/2.0/files/content -H "Authorizatio
n:Bearer access~~~~~~~~~~~~~~~~~~~~~~~~~~" -X POST --proxy http://127.0.0.1:3213
 -F attributes="{\"name\":\"ulspeedtest\",\"parent\":{\"id\":\"0\"}}" -F file=@u
lspeedtest -o result.txt

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 50.0M  100  1058  100 50.0M     88  4266k  0:00:12  0:00:12 --:--:--  201k

100 50.0M  100  1058  100 50.0M     37  1828k  0:00:28  0:00:28 --:--:-- 1188k

100 50.0M  100  1058  100 50.0M    117  5688k  0:00:09  0:00:09 --:--:-- 9652k

100 50.0M  100  1058  100 50.0M    132  6400k  0:00:08  0:00:08 --:--:-- 8721k

100 50.0M  100  1058  100 50.0M     70  3413k  0:00:15  0:00:15 --:--:-- 6188k


---------------------------------------------------------------------------------------------------
upload to box - curl compiled myself - no proxy

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\libcurl-vc8-x86-release-dll-ssl-dll-zl
ib-dll-ipv6\bin>curl https://upload.box.com/api/2.0/files/content -H "Authorizat
ion:Bearer access~~~~~~~~~~~~~~~~~~~~~~~~~~" -X POST --cacert cacert.pem -F attr
ibutes="{\"name\":\"ulspeedtest\",\"parent\":{\"id\":\"0\"}}" -F file=@ulspeedte
st -o result.txt

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 50.0M  100  1058  100 50.0M      6   314k  0:02:56  0:02:43  0:00:13  258k

100 50.0M  100  1058  100 50.0M      7   345k  0:02:31  0:02:28  0:00:03  321k

100 50.0M  100  1058  100 50.0M      7   363k  0:02:31  0:02:21  0:00:10  305k

100 50.0M  100  1058  100 50.0M      6   324k  0:02:56  0:02:38  0:00:18  285k

100 50.0M  100  1058  100 50.0M      7   365k  0:02:31  0:02:20  0:00:11  308k

---------------------------------------------------------------------------------------------------
upload to box - curl compiled myself - proxy set

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\libcurl-vc8-x86-release-dll-ssl-dll-zl
ib-dll-ipv6\bin>curl https://upload.box.com/api/2.0/files/content -H "Authorizat
ion:Bearer access~~~~~~~~~~~~~~~~~~~~~~~~~~" -X POST --cacert cacert.pem --proxy
 http://127.0.0.1:3213 -F attributes="{\"name\":\"ulspeedtest\",\"parent\":{\"id
\":\"0\"}}" -F file=@ulspeedtest -o result.txt

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 50.0M  100  1058  100 50.0M     55  2694k  0:00:19  0:00:19 --:--:-- 3239k

100 50.0M  100  1058  100 50.0M     48  2327k  0:00:22  0:00:22 --:--:-- 1961k

100 50.0M  100  1058  100 50.0M    105  5120k  0:00:10  0:00:10 --:--:-- 9434k

100 50.0M  100  1058  100 50.0M     58  2844k  0:00:18  0:00:18 --:--:-- 5586k

100 50.0M  100  1058  100 50.0M    117  5688k  0:00:09  0:00:09 --:--:-- 4332k

---------------------------------------------------------------------------------------------------
upload to box - PostUpload.c - no proxy
  edit PostUpload.c:

  curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
  curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback);
  curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &progress_data);
  progress_data.session = curl;

  /* test - upload file to box */
  header_list = curl_slist_append(header_list, "Authorization: Bearer 
MDU2VZdbuWl8aSKuWyA34yNCEldLODqO");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header_list);

  curl_httppost *post = NULL;
  curl_httppost *last = NULL;
  curl_formadd(&post, &last,
          CURLFORM_COPYNAME, "attributes", 
          CURLFORM_COPYCONTENTS, "{\"name\":\"ulspeedtest\", 
\"parent\":{\"id\":\"0\"}}",
          CURLFORM_END);

  curl_formadd(&post, &last,
          CURLFORM_STREAM, fp,
          CURLFORM_PTRNAME, "file",
          CURLFORM_FILENAME, "ulspeedtest",
          CURLFORM_CONTENTLEN, (curl_off_t)stbuf.st_size,
          CURLFORM_END);

  curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);


Transfer rate: 361 KB/sec (52429188 bytes in 142 seconds)
Other data rate units:

                  2.95 Mbps
               2953.75 kbps
                  0.35 MiB/s
                360.57 KiB/s
                369.22 kB/s
             369219.00 B/s

Transfer rate: 316 KB/sec (52429188 bytes in 162 seconds)
Other data rate units:

                  2.59 Mbps
               2589.09 kbps
                  0.31 MiB/s
                316.05 KiB/s
                323.64 kB/s
             323636.00 B/s

Transfer rate: 318 KB/sec (52429188 bytes in 161 seconds)
Other data rate units:

                  2.61 Mbps
               2605.18 kbps
                  0.31 MiB/s
                318.01 KiB/s
                325.65 kB/s
             325647.00 B/s

Transfer rate: 318 KB/sec (52429188 bytes in 161 seconds)
Other data rate units:

                  2.61 Mbps
               2605.18 kbps
                  0.31 MiB/s
                318.01 KiB/s
                325.65 kB/s
             325647.00 B/s

Transfer rate: 322 KB/sec (52429188 bytes in 160 seconds)
Other data rate units:

                  2.64 Mbps
               2637.94 kbps
                  0.31 MiB/s
                322.01 KiB/s
                329.74 kB/s
             329743.00 B/s


---------------------------------------------------------------------------------------------------
upload to box - PostUpload.c - proxy set
        add code to PostUpload.c before:
        /* test - proxy */
        curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
        curl_easy_setopt(curl, CURLOPT_PROXY, "127.0.0.1:3213");

Transfer rate: 1896 KB/sec (52429188 bytes in 27 seconds)
Other data rate units:

                 15.53 Mbps
              15534.57 kbps
                  1.85 MiB/s
               1896.31 KiB/s
               1941.82 kB/s
            1941821.00 B/s

Transfer rate: 1896 KB/sec (52429188 bytes in 28 seconds)
Other data rate units:

                 15.53 Mbps
              15534.57 kbps
                  1.85 MiB/s
               1896.31 KiB/s
               1941.82 kB/s
            1941821.00 B/s

Transfer rate: 4267 KB/sec (52429188 bytes in 13 seconds)
Other data rate units:

                 34.95 Mbps
              34952.79 kbps
                  4.17 MiB/s
               4266.70 KiB/s
               4369.10 kB/s
            4369099.00 B/s

Transfer rate: 3938 KB/sec (52429188 bytes in 13 seconds)
Other data rate units:

                 32.26 Mbps
              32264.11 kbps
                  3.85 MiB/s
               3938.49 KiB/s
               4033.01 kB/s
            4033014.00 B/s

Transfer rate: 7314 KB/sec (52429188 bytes in 7 seconds)
Other data rate units:

                 59.92 Mbps
              59919.07 kbps
                  7.14 MiB/s
               7314.34 KiB/s
               7489.88 kB/s
            7489884.00 B/s
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to