Re: [whatwg] Expose XMLHttpRequest [Fetch?] priority

Weight is actually not what I want.  I want priority.  They're different
concepts in that priority implies trumping and weight implies proportional
resource allocation.

That is, if I make 10 high-priority requests, 20 medium-priority requests,
and 30 low-priority requests, I don't want ANY of the low-priority requests
to consume any resources until either 1) all higher-priority requests have
been serviced or 2) there are spare resources that cannot otherwise be used
for higher-priority requests.

As you quoted, "Streams with the same parent SHOULD be allocated resources
proportionally based on their weight."  Proportional allocation would be
incorrect for this use case.

Does that make sense?  Is there anything I can clarify?

p.s. I believe it's theoretically possible for an HTTP 2.0 client to map
priorities onto stream dependencies, but it seems like the implementation
would require a great deal of additional complexity.  That is, a stream
would be required for every possible priority level.  Assume set of streams
N at priority P and set of streams M at priority P+2.  All of N (streams of
priority P) would need to depend on an arbitrary stream in M (priority
P+2).  When the stream at priority P+2 is closed, the client would need to
reattach all of N to another arbitrary stream in M.  The addition of a new
stream at priority P+1 would require reattaching everything in N (priority
P) to the new stream.

p.p.s. I asked a friend who stays relatively up-to-date with HTTP 2.0 on
whether it's possible to implement SPDY-like priority on HTTP 2.0.  His
conclusion was "yes, with stream dependencies, but it would require the
client to do a lot of work, and that feedback should go to ietf-http-wg@"
To that end, I posted the following:
http://lists.w3.org/Archives/Public/ietf-http-wg/2014OctDec/0016.html



On Wed, Oct 1, 2014 at 8:19 PM, Ilya Grigorik <igrigorik@gmail.com> wrote:

>
> On Wed, Oct 1, 2014 at 7:59 PM, Chad Austin <caustin@gmail.com> wrote:
>
>> I don't see a way to set a priority value in there.  The specific wording
>> is "Streams can be prioritized by marking them as dependent on the,
>> completion of other streams".
>>
>> I see that a client can specify the weight of a stream and you can say
>> that a stream depends on another stream.  Neither of those are what I
>> want.  I simply want to specify priorities of a bunch of requests.  How
>> would I do that in HTTP 2.0?
>>
>
> Weight is exactly what you want:
> http://tools.ietf.org/html/draft-ietf-httpbis-http2-14#section-5.3.2
>
> "A stream that is not dependent on any other stream is given a stream
>    dependency of 0x0.  In other words, the non-existent stream 0 forms
>    the root of the tree."
>
> All dependent streams are allocated an integer weight between 1 to
>    256 (inclusive)... Streams with the same parent SHOULD be allocated
> resources
>    proportionally based on their weight. "
>
> In other words, if you don't care about dependencies, then don't assign
> the parent. Doing so will make all streams children of the root of the tree
> (0x0), and from there you can use weights to assign relative priority.
>
> Hope that makes sense.
>
> ig
>
>
>
>


-- 
Chad Austin
http://chadaustin.me

Received on Thursday, 2 October 2014 03:40:23 UTC