cURL / Mailing Lists / curl-library / Single Mail

curl-library

AW: SV: curl vs. sftp

From: may nothing <may_241913_at_yahoo.com>
Date: Thu, 30 Sep 2010 14:35:31 +0000 (GMT)

I removed the curl_easy_setopt(curl, CURLOPT_VERBOSE, 1) line completely and
re-did the test. No performance improvement could be observed.

cu
may

----- Ursprüngliche Mail ----
Von: Mehmet Bozkurt <mehmet.bozkurt_at_xware.se>
An: libcurl development <curl-library_at_cool.haxx.se>
Gesendet: Donnerstag, den 30. September 2010, 12:56:11 Uhr
Betreff: SV: curl vs. sftp

> Hi all,
>
> I'm facing a jet strange problem. At the moment most of our applicatios
> are
> using the libcurl (latest version: 7.21.1)
> But now one of our customers came up and complained that retrieving a
> file via
> the standart RedHat 4 sftp client would be much faster than our apps
> using the
> curl library.
> So I made a few tests and hacked a quick-and-dirty C prog and used the
> unix
> "time" command to measure the download time.
>
> Swiftly said: It took nearly 12 minutes to get 250 MB via curltest2 app
> while it
> only took roughly 3 minutes with the sftp client.
>
> Any ideas ?
>
> here is the curltest2:
>
> #include <stdio.h>
>
> #include <curl/curl.h>
> #include <curl/types.h>
> #include <curl/easy.h>
>
> size_t my_fwrite(void *buffer, size_t size, size_t nmemb, FILE *stream)
> {
> static int first_time=1;
> char outfilename[FILENAME_MAX] = "testfile.bin";
> static FILE *outfile;
> size_t written;
> if (first_time)
> {
> first_time = 0;
> outfile = fopen(outfilename,"wb");
> if (outfile == NULL)
> {
> return -1;
> }
> fprintf(stderr,"The body is <%s>\n",outfilename);
> }
> written = fwrite(buffer,size,nmemb,outfile);
> return written;
> }
>
>
>
> int main(void)
> {
> CURL *curl;
> CURLcode res;
>
> curl = curl_easy_init();
> if(curl)
> {
> curl_easy_setopt(curl,
> CURLOPT_URL,"sftp://192.168.0.1/test/myTestfile.bin");
> curl_easy_setopt(curl, CURLOPT_USERPWD, "bla:blub");
> curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite);
>
> curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
>
> res = curl_easy_perform(curl);
> curl_easy_cleanup(curl);
>
> if(CURLE_OK != res)
> {
> fprintf(stderr, "curl told us %d\n", res);
> }
> }
>
> return 0;
> }

Try turning off curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); ->
curl_easy_setopt(curl, CURLOPT_VERBOSE, 0);
and run your benchmark again.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-09-30