curl-library
Re: Setting priority for an easy handle in a multihandle
Date: Mon, 30 Apr 2012 23:12:56 +0200 (CEST)
On Mon, 30 Apr 2012, gokhansengun_at_gmail.com wrote:
> We need to get on the same page. In order to get a hard real time effect,
> you need operating system support, it has to provide you a real time TCP/IP
> stack. What I suggested can only work on the "best effort basis". It can
> only help you to avoid procesing a low priority jobs while high priority job
> is waiting for attention.
How does this "real time TCP/IP stack" let you do that in a way that a
"normal" stack doesn't?
> That is the whole point here. After returning from select, my code first
> checks whether high priority job needs action, if so action is provided and
> without doing any more work we are selecting again with the minimum expiry
> time.
Then you need to make your second select() exclude the low-priority sockets as
otherwise they will just trigger select() immediately again - and this is of
course not easily done with libcurl within a single multi handle and that's a
reason for you to use multiple ones.
With the multi_socket() API it would possibly be easier to do within a single
handle.
Hm, come to think about it. Perhaps your way can also be achieved with some
clever use of curl_easy_pause() on the low-prio transfers while there are
high-prio ones to deal with...
> This goes on until select wakes up with no higher priority job needs
> immediate attention, then we process low priority job.
Aah yes, that's how you can "sleep too long" since you then enforced a sleep
onto the low prio transfers that they didn't ask for.
> Why not utilizing the whole bandwidth for low priority jobs when there is no
> or low density of high priority jobs?
Your approach has the downside that it might completely ignore the low-prio
transfers while you have a few high speed important ones. Of course I
understand that you have things tested out and working for your case, but I'm
thinking if we would do something in a generic way for everyone.
Your way does indeed have the upside that it lets the low-prio connections
reach full speed if no high prio connections are used.
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2012-04-30