Re: Retrospective on PRIORITY

Tom Bergan <tombergan@chromium.org> Tue, 18 April 2017 20:57 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D3B10129482 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 18 Apr 2017 13:57:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.001
X-Spam-Level:
X-Spam-Status: No, score=-7.001 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=chromium.org
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GL9MG3xGseWa for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 18 Apr 2017 13:57:19 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id ED39412783A for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 18 Apr 2017 13:57:18 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1d0a8U-00015X-K4 for ietf-http-wg-dist@listhub.w3.org; Tue, 18 Apr 2017 20:54:06 +0000
Resent-Date: Tue, 18 Apr 2017 20:54:06 +0000
Resent-Message-Id: <E1d0a8U-00015X-K4@frink.w3.org>
Received: from mimas.w3.org ([128.30.52.79]) by frink.w3.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <tombergan@chromium.org>) id 1d0a8R-00014c-L9 for ietf-http-wg@listhub.w3.org; Tue, 18 Apr 2017 20:54:03 +0000
Received: from mail-wr0-f171.google.com ([209.85.128.171]) by mimas.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <tombergan@chromium.org>) id 1d0a8J-000337-BO for ietf-http-wg@w3.org; Tue, 18 Apr 2017 20:53:58 +0000
Received: by mail-wr0-f171.google.com with SMTP id l28so2963318wre.0 for <ietf-http-wg@w3.org>; Tue, 18 Apr 2017 13:53:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=uWm+yyAXM3L8M3lqJySCgaFDnjMqTuRC7hHsoptkc3Q=; b=bVbBeBBcLgYnj371wwrNRLpmbFweoENSftH03SamZA+qoAVm+Zn08doOH/yuN8Dctg DPJxC+w40L7BOcRyTeVIeeBGlO1dlh4T28cn45W1Ji8+IeuSh4gAC2+tVP8wrWA+aJ4D KS5vIWOoFLddBAZb5rtAESHwI2ZaGbhO9HFME=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=uWm+yyAXM3L8M3lqJySCgaFDnjMqTuRC7hHsoptkc3Q=; b=jMkoJL78NVlBgnntnjP2mYUkmbqkBfScQXDaQvOPclEpe/0E8IrDXbLaCUhveCAoCk TSdkWthkQGCN1+UjW+mPhdwJbV4bdz8xhZYHEy8MVqRGNSYx1aztDhHojaLBIq8JQv1A 6raZm3ISAQ8EeNt3ALWjHOW+tVovXcvZYdM8ayMl2EpHL7Yq2Hf8wtbdmWQ+d325GQtG AwAsd2qGiMyfTb+kLXGwXbUmeGdyLkM9R7WPBCsM/u6qE4DtLH2vemIf8/qGrUzKP9Sr Mb3bLNSjUOKAn5VYN49lqUjAddCJmpV5BsBzwcDU+CxaMuY8sI7JtSvrbwGbQ+5kqugy yBFw==
X-Gm-Message-State: AN3rC/5CAUfwlp275vh/nM4pnsWvxid51LIjvB7WYtKSvak4iC844Ms2 pIQERnsSv5KhAsFJ5I/OPw==
X-Received: by 10.223.171.6 with SMTP id q6mr24886842wrc.147.1492548807779; Tue, 18 Apr 2017 13:53:27 -0700 (PDT)
Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com. [74.125.82.45]) by smtp.gmail.com with ESMTPSA id q130sm16437193wmd.29.2017.04.18.13.53.26 for <ietf-http-wg@w3.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Apr 2017 13:53:27 -0700 (PDT)
Received: by mail-wm0-f45.google.com with SMTP id o81so65619485wmb.1 for <ietf-http-wg@w3.org>; Tue, 18 Apr 2017 13:53:26 -0700 (PDT)
X-Received: by 10.28.16.65 with SMTP id 62mr9193471wmq.75.1492548806365; Tue, 18 Apr 2017 13:53:26 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.28.147.146 with HTTP; Tue, 18 Apr 2017 13:53:25 -0700 (PDT)
In-Reply-To: <BN6PR03MB2708D32F12FAF2953E0F499487190@BN6PR03MB2708.namprd03.prod.outlook.com>
References: <BN6PR03MB2708D32F12FAF2953E0F499487190@BN6PR03MB2708.namprd03.prod.outlook.com>
From: Tom Bergan <tombergan@chromium.org>
Date: Tue, 18 Apr 2017 13:53:25 -0700
X-Gmail-Original-Message-ID: <CA+3+x5ENRs02rjAZbpe7TY7e7gSXJoCxHTZeKKRhuE9rXxK2Hw@mail.gmail.com>
Message-ID: <CA+3+x5ENRs02rjAZbpe7TY7e7gSXJoCxHTZeKKRhuE9rXxK2Hw@mail.gmail.com>
To: Mike Bishop <Michael.Bishop@microsoft.com>
Cc: HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="001a114721ae6a3c5e054d7719f2"
Received-SPF: pass client-ip=209.85.128.171; envelope-from=tombergan@chromium.org; helo=mail-wr0-f171.google.com
X-W3C-Hub-Spam-Status: No, score=-4.0
X-W3C-Hub-Spam-Report: AWL=2.790, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.8, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: mimas.w3.org 1d0a8J-000337-BO 1c7b7b043aa42c513e8ff09f710ae272
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Retrospective on PRIORITY
Archived-At: <http://www.w3.org/mid/CA+3+x5ENRs02rjAZbpe7TY7e7gSXJoCxHTZeKKRhuE9rXxK2Hw@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/33825
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

I cannot speak to the proxy use case, but FWIW, I completely support
changing the priority scheme not only in QUIC, but also HTTP/2. One reason
is that HTTP/2 priority scheduling is O(n) in the worst case (
https://lists.w3.org/Archives/Public/ietf-http-wg/2017JanMar/0107.html).
Another reason in the complexity, which has been discussed elsewhere.

However, the biggest reason is that I haven't seen much real evidence that
HTTP/2's priority scheme performs strictly better than something simpler
like SPDY's, even ignoring the O(n) issue. A few months ago, I did a small
study of page load times in Chrome, comparing HTTP/2's priority scheme vs
SPDY's (https://docs.google.com/document/d/1oLhNg1skaWD4_DtaoCxdSRN5erEXrH-
KnLrMwEpOtFY/edit#heading=h.921ubylubq2r). I found that SPDY pageloads were
faster about 35% of the time, HTTP/2 pageloads were faster about 20% of the
time, and the remaining 45% of cases showed no difference.

Don't read too much into those specific numbers. The takeaway is that it's
impossible to express some priorities in HTTP/2 that could be expressed
with SPDY, which means that HTTP/2 is not strictly better than SPDY. Take
the following example:

r1 <- r2 <- ... <- rN <- (group A of unordered requests) <- (group B of
unordered requests)

In this example, (r1, r2, ..., rN) might be a sequence of scripts that need
to be evaluated in a linear order, group A might be high-priority images,
and group B might be low-priority images. Or, group A could be images and
group B could be async scripts. For group A and group B, the browser does
not know the true dependency order and is making some heuristic guesses. In
SPDY, we might not have enough priority levels to fully express the linear
ordering from r1 to rN, so we have to collapse them:

pri=0 (r1 ... rN), pri=1 (groupA), pri=2 (groupB)

This is obviously suboptimal and demonstrates why HTTP/2 might be faster
than SPDY. However, in HTTP/2, we cannot express the dependence between
group A and group B because the A-to-B dependencies are a DAG, not a tree.
There are a few ways this can be encoded in HTTP/2, but they are all
suboptimal in some way.

I really like Osama Mazahir's proposal. With 64-bit integer priorities, we
have enough space to generate any linear order that will arise in practice
(at least for browser clients), yet we can also handle cases like the
above. The "groups" let us naturally give separate weights to individual
tabs. Hierarchical groups could be added if needed by proxies. I believe
(but have not proven) that a scheduler over hierarchical groups would be
O(depthOfGroupTree) in the worst case, which isn't so bad if we expect that
depthOfGroupTree = O(numProxies) most of the time.

On Tue, Apr 18, 2017 at 11:46 AM, Mike Bishop <Michael.Bishop@microsoft.com>
wrote:

> I had an interesting side conversation in Chicago, where it was proposed
> that HTTP/QUIC pull out the H2 priority scheme and go with something
> simpler, or at least make all priority schemes extensions so client/server
> can negotiate which one they want to use.  I think efforts like that
> probably need to be driven out of the HTTP WG rather than the QUIC WG, but
> it did raise some interesting questions.
>
>
>
> Back in this thread (https://lists.w3.org/Archives/Public/ietf-http-wg/
> 2014JanMar/0396.html), we had a proposal which permits expressing the
> same desired end-states, but requires the client to do the tree collapsing
> instead of the server.  That means clients can be as simple or as complex
> as they desire, and the server just needs to see the end output of whatever
> fancy algorithm they’re using.
>
>
>
> The argument that drove the current scheme was that when running a proxy,
> you need a way to be able to encapsulate the priorities declared by one
> client onto priorities in a back-end connection while isolating the user’s
> declared priorities from other users’ declared priorities.  Clearly you
> can’t just do a straight pass-through, or everyone is incented to use the
> top end of the priority range.  The scheme that ultimately landed in H2
> allows this at the proxy:
>
>    - Every user gets a placeholder node; weights of placeholders
>    represent relative priorities of the users
>    - Anything the user declares depends on stream zero in their
>    connection depends on this placeholder; weights unchanged
>    - Anything the user declares depends some other stream still depends
>    on that stream; weights unchanged
>
> Also, when something changes near the root of the tree, the client might
> be issuing a *lot* of PRIORITY frames to update everything as a result if
> all the server gets is the output of the tree.  In the video playback case,
> finishing the current chunk is a change near the root of the tree that’s
> fairly common.
>
>
>
> With any simpler scheme, the proxy either has to ignore declared
> priorities or do work to coalesce declared priorities across users.  And
> obviously, if you have tiers of proxies, the same logic can be applied
> multiple times and still get a sensible result at the back-end.  You could
> bring that idea into the proposal linked above, but you’d need
> groups-of-groups, and groups-of-groups-of-groups, and soon you wind up with
> something that looks a lot like a dependency tree again.
>
>
>
> I think any reasonable priority scheme will work fine between client and
> server – it’s the proxy (forward or reverse) that needs to see the
> uncollapsed tree so that it can merge trees between clients.  Now that H2
> is deployed, I’m curious how proxy vendors are finding this to work out.
> Do you find the additional richness useful, or is there more appetite for
> simpler priority schemes?  Are you actually using the algorithm above, or
> something like it?
>