cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Disabling keepalive not working?

From: Igor Sverkos <igor.sverkos_at_googlemail.com>
Date: Sun, 21 Apr 2013 13:48:30 +0200

Hi,

Daniel Stenberg wrote:
>> I am trying to deactivate keepalive but I am not sure if it is
>> really deactivated -- would say no:
>
> I think this is because of a misunderstanding about what the option
> does.

Possible.

> --no-keepalive is clearly documented that it "Disables the use of
> keepalive messages on the TCP connection, as by default curl enables
> them".
>
> What may be less clear is that the "keepalive messages" it talks
> about is TCP-level "chatter" that makes the connection get used
> instead of remaining completely idle when nothing is being sent over
> it. See http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html

OK, I must admit that I wrongly thought the option affects "HTTP
Keepalive". Although you write in the documentation that it only affects
TCP...

I think I have overseen that, because I was too much into HTTP (there is
an HTTP Keepalive I know very well) and in time I read that (because I
am using cURL to fetch something from HTTP) I really did not know more
about TCP's keepalive.

Sorry.

> You seem to be after preventing libcurl to use persistend
> connections so that it won't keep connections open for subsequent
> re-use. That's not what the --no-keepalive option is about - and we
> should probably improve the documentation to clarify this.
>
> The curl tool actually has no option that can forcible make a
> connection not being tried for re-use afterward. libcurl has, but
> that ability has never been exposed by the tool since we haven't had
> any reason to.
>
> Can you elaborate a little on why you want to do this?

Well, I implemented cURL in an client/server application. cURL is used
at client side and used in the updater mechanism. Multiple clients
(>100) will fetch files from the same resource at nearly the same time.
I saw the "Connection #0 to host curl.haxx.se left intact" message and
thought:

"Uhh, it is maybe not a good thing to left connections intact... when
the server will keep an connection open, I will waste server resources."

So I wrongly thought it is related to HTTP's keepalive and could be
turned off by applying the "--no-keepalive" option.

Anyway, think this is a server configuration problem if it is a problem
at all. But current webservers have a default HTTP keepalive timeout of
5-10 seconds so there isn't a problem.

This was a 'PEBKAC'. Sorry :)

-- 
Regards,
Igor
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-04-21