cURL / Mailing Lists / curl-library / Single Mail


Limiting the rate of new connections

From: David Galeano <>
Date: Fri, 4 Dec 2015 20:17:20 +0000

Is there a way to limit the number of new connections opened per second? I know I can limit the maximum number of total connections, and the number of connections that stay opened on the connection cache, but I have not found an easy way to control how many new connections are opened per second.
The reason I am asking this question is because I have problems with some proxy servers timing out if I open too many connections too quickly. I can open lots of connections slowly, and once open they handle lots of requests in parallel without problems, but the proxies seem to collapse when I open too many connections in a sort period of time.
My program has to run for long periods of time and the load is unpredictable, it can be low for a while and suddenly spike with a big number of request to perform. So far I have not managed to accurately predict how many connections libcurl will open under the hood. I am using libcurl's multi interface and I can limit how many handles I add per second, but whether those will use existing connections or open new ones is hard to predict and to limit.

List admin:
Received on 2015-12-04