cURL / Mailing Lists / curl-library / Single Mail

curl-library

How long a connection is persisted if period of inactivity

From: Pierre Morel <pmorel_at_gmail.com>
Date: Thu, 18 Mar 2010 18:55:33 +0000

I'm using libcurl to access a web service and for efficiency, trying
to reuse connections. It's all working fine when I perform request
after request without too long delay.

However, if there is a period of inactivity (no call to
easy_curl_perform or any curl function) of more than 15 seconds, then
the request takes a lot longer (basically instead of an average 70ms,
it's 350ms and as soon as the internet is slow, it increases from
300ms to 2-3seconds). Using tcpdump, it looks like in this case, curl
does not reuse previous connections and perform all the initialisation
(using gdb, it shows Curl_connect being called 6 times instead of one
only) like it does for first connection.

Configuration: linux ubuntu 9.10, libcurl 7.18.1, openssl 0.9.8g

The same code works fine on Windows (or at least it looks like it works fine)

I've tried a couple of options like CURLOPT_MAXCONNECTS (I'm using one
curl handle so 5 should be already enough), CURLOPT_DNS_CACHE_TIMEOUT
without success. I'm also calling curl_easy_reset(m_Curl); before each
new transfer.

What could be the cause of this? How can I fix this?

Thanks for your help

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