curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Time taken by curl_easy_perform

From: Vidyanand Nille via curl-library <curl-library_at_cool.haxx.se>
Date: Sun, 01 Oct 2017 19:32:20 +0530

  Original Message  
From: dan_at_coneharvesters.com
Sent: October 1, 2017 3:38 PM
To: curl-library_at_cool.haxx.se
Reply-to: curl-library_at_cool.haxx.se
Subject: Re: Time taken by curl_easy_perform

On Sun, Oct 01, 2017 at 11:20:02AM +0530, Vidyanand Nille via curl-library wrote:
> I am using curl 7.29 on RHEL 7.1.
>
> When I tried hitting URL with curl command it's taking 10ms to get complete
> response but same URL when fetched from curl_easy_perform function it's taking
> 50ms to get response.
>
> I tried it multiple times but there is consistent difference of 35-40 ms
> between curl command and libcurl function.
>
> When debugged further, through curl_easy_perform I am getting response header
> in 10ms but response data is coming after 30ms difference always. Behavior is
> consistent. What could be reason?

>Well, curl uses libcurl internally, too, so it's probably >due to the transfer
>being set up differently. Did you make sure your >program is using the same
>libcurl as the curl front-end (e.g., it's not picking up >another version in
>/usr/local/lib by mistake)? 

Using same libcurl version in both the cases.

>You can use the --libcurl option (if it's
>available in that old curl version) to see what >options are being set by curl
>for the transfer and try to do exactly the same >options in your program.

Yes tried with same options, only addition is registering header and data callback functions.

>How
>are you measuring the transfer times? Make sure >you're not accidentally
>measuring program startup time in addition to the >transfer itself. 

I had just taken time before curl_easy_perform and after curl_easy_perform function so no time of startup.

>Have you
>tried using the logging options to narrow where the >time is being spent in your
>program? Have you tried using the curl_easy_getinfo >options to log the time
>spent in various phases?

I didn't try logging options but I had taken time at every step even in callback functions. Header callback function is called in 10ms and data callback function is always called after 30ms difference after all header is received.

>>>
Regards,
Vidyanand

>>> Dan
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-10-01