cURL / Mailing Lists / curl-library / Single Mail


Re: limit connection cache growth on multi interface [PATCH]

From: James Bursa <>
Date: Tue, 5 Jun 2007 22:09:59 -0500

On Wednesday 30 May 2007 06:02, Daniel Stenberg wrote:
> When using the multi interface the connection cache is made to grow for
> each new easy handle that is added, to hold up to 4 * easy_handles.
> This patch introduces the new setting CURLMOPT_MAXCONNECTS to allow an app
> to set a max number of entries in the cache.
> Possibly we should rather change the default algorithm to instead be
> something like "10 + easy_handles" since this excessive amount might be a
> bit too silly...
> Thoughts or opinions on the patch or the cache size or related?

This will be very useful for me. I did some testing with a modified
10-at-a-time.c (patch attached), and it works ok.

I found that the number of connections can still be above this limit if the
number of easy handles is greater. For example, set MAX to 30, and it will
use 30 connections. Is it too late to rename the option to something like
CURLMOPT_MAXCONNECTCACHE to make this clearer?

A value less than 10 is treated as 10, due to the default 10 in
Curl_mk_connc(). Would reducing that cause any problems?

I'm not sure if the default should be an algorithm based on the number of easy
handles. We could just make it a fixed size, and let the user use this option
if they want something else.

Thanks for your work on this!


Received on 2007-06-06