cURL / Mailing Lists / curl-library / Single Mail


Re: multi interface perf question

From: Alan Wolfe <>
Date: Fri, 4 Feb 2011 14:51:13 -0800

err.. sorry i got a little hasty there...

so i do have a select before my curl_multi_perform with a timeout of

In theory i should be able to even set that to 0 usec's just to poll if
there is data ready without even blocking for those 10 usecs.

That aside, my issue still remains.

If i have a tight loop of polling for more data and a sleep(1) to yield the
thread vs polling once a frame, i get vastly different response times on my
requests (as stated before).

I checked the example code and my code is identical:

Any idea what could be going on?

On Fri, Feb 4, 2011 at 2:40 PM, Alan Wolfe <> wrote:

> i'm doing a select before the curl_multi_perform with a small timeout (10
> usec's)
> Now of course it seems obvious what the problem is hehe... i probably
> should be using more than 10usec's if i want it to do more work per frame
> eh?
> I'm going to give that a shot... thanks a bunch!
> On Fri, Feb 4, 2011 at 2:03 PM, Dan Fandrich <>wrote:
>> On Fri, Feb 04, 2011 at 01:29:28PM -0800, Alan Wolfe wrote:
>> > Quick update... i notice that if i tick the multi interface 20 times per
>> frame
>> > instead of just once, i get response time back down to the 2-3 second
>> range.
>> >
>> > I don't notice any drop in frame rate but i haven't done any real perf
>> tests.
>> >
>> > I'm sure it takes SOME more amount of time but not sure how much, or how
>> that
>> > amount of time might vary from system to system.
>> It sounds like you're calling curl_multi_perform() in a busy loop, without
>> checking if network sockets are ready or not. If so, this is not the way
>> it's
>> supposed to be done. The app is supposed to only call it when there is
>> data
>> ready to read/write or after a timeout. In the meantime, unless there's
>> something else for it to do, it should be blocked on a select() or poll()
>> call or similar. Please read the man page and take a look at the example
>> code to see how this is supposed to work.
>> >>> Dan
>> -------------------------------------------------------------------
>> List admin:
>> Etiquette:

List admin:
Received on 2011-02-04