cURL / Mailing Lists / curl-library / Single Mail


Re: curl-library Digest, Vol 67, Issue 18

From: Dan Fandrich <>
Date: Fri, 11 Mar 2011 14:42:39 -0800

On Fri, Mar 11, 2011 at 04:32:05PM -0500, Pankaj Takawale wrote:
> Platform is linux 2.6.18
> curl is 7.15.4
> Server is breaking connection every minute one to three times (no
> particular pattern timing wise)
> Is there any way to tell curl to make only connection (not issue http
> GET) with server if connection is broken?

curl transfers data from/to URLs, so it won't by default make a connection
without doing anything with said connection (like transferring URLs). You
can set the CURLOPT_CONNECT_ONLY option, but your app would be responsible
for knowing when to set that option.

> I dont think preemption is happening for so long time - otherwise I
> would have noticed it if it had happened somewhere else other than
> curl api.

Clearly, something is happening in those extra few hundred milliseconds.
You are claiming that this time is being spent in libcurl, but so far I
haven't seen any evidence of that.

> Request was made at around 11:01:12.302
> curl_easy_perform returned at 11:01:13.184
> 11:01:13.184617 errcode: 200
> 11:01:13.184636 totaltime: 881.819000
> 11:01:13.184651 connecttime: 653.956000
> 11:01:13.184670 avgdnldspeed: 965.000000
> 11:01:13.184686 size : 851.000000
> 11:01:13.184698 filetime(sec): -1
> 11:01:13.184715 namelookuptime: 649.325000
> 11:01:13.184735 pre_xfer_time: 771.337000
> 11:01:13.184752 start_xfer_tim: 881.801000
> 11:01:13.184767 redirect_time: 0.000000
> 11:01:13.184774 redirect_count: 0
> Curl is claiming connection time 653 ms, n/w trace does not support that.

This shows elapsed wall time, but it doesn't help in determining where
that time is being spent. Try installing a CURLOPT_DEBUGFUNCTION and logging
each entry with a high-resolution time stamp, as well as logging timestamps
for the received data. That may give a clue as to what may be happening
within libcurl. Try using oprofile or another profiling tool to try to
figure out where that time is being spent. strace with the -c and -T options
is a way to see if the time is being spent in the kernel or in the app.

>>> Dan
List admin:
Received on 2011-03-11