cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Multi interface efficiency woes

From: Ben Noordhuis <info_at_bnoordhuis.nl>
Date: Sat, 19 Feb 2011 23:15:41 +0100

On Sat, Feb 19, 2011 at 20:24, Michael Fischer <michael_at_dynamine.net> wrote:
> And until the response is returned, the underlying descriptor will
> *always* be writable after it has connected.  But since we have no
> knowledge of what's going on with the underlying HTTP transaction, we
> ignorantly keep calling curl_multi_perform() anyway.  This is very
> expensive, but we can't stop doing it until we get our response.  The
> CPU expense is proportional to the response latency.
>
> What can be done to make this more efficient?

You should register CURLMOPT_TIMERFUNCTION and CURLMOPT_SOCKETFUNCTION
callbacks. See [1] for an example.

[1] https://github.com/bagder/curl/blob/master/docs/examples/hiperfifo.c

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-19