cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP Pipelining Contributions

From: Vladimir Grishchenko <vladgri_at_hotmail.com>
Date: Wed, 25 Jul 2012 09:27:03 -0700

> FIFO to start, but we should consider expandability.
>
> Can you suggest an interface that would let the client prioritize queued
> requests?
>
> I can think of a couple off the top of my head:
>
> 1. Allow the client to provide a sort function for requests. If one is
> set, then requests are stored in a priority queue using that sort
> function. If not, use FIFO.
>
> This has the advantage of being simple and expandable, but needs a call
> through a function pointer for every request.
>
> 2. Add an algorithm parameter (initially defining only FIFO), and have
> curl implement other algorithms internally.
>
> This can be optimized well, but is a lot harder to extend and could cause
> bloat inside curl.
>
> (In both of these cases, we can default to FIFO if the new option is not
> set, so the option can be added after the initial work is done.)
>
> Joe

I was thinking along the lines that a new int "easy" option can be
introduced for expressing priorities so that the clients can set whatever
priority they want, internally libcurl would not attempt to interpret the
value but would simply maintain a queue sorted by handle priority. If the
client chooses not to set priorities then all handles will have the same
default priority value assigned with the net effect being a FIFO case.

A sort callback seems like another fine approach however it would be helpful
if a default implementation was available so that it can be used without
rolling out your own solution every time a client wishes to use priorities.

One useful feature I think will be to allow the client to manipulate
priorities of pending requests and re-sort the queue based on new priority
values.

-Vladimir

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-07-25