Re: Server Push and Caching

David Witherspoon <dwitherspoon2011@gmail.com> Thu, 25 May 2017 13:15 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 0D3C412954B for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 25 May 2017 06:15:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.9
X-Spam-Level:
X-Spam-Status: No, score=-6.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, 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
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 eCjyTN8M0e0m for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 25 May 2017 06:15:41 -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 C594F1294D8 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Thu, 25 May 2017 06:15:41 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1dDsYd-0001nq-0d for ietf-http-wg-dist@listhub.w3.org; Thu, 25 May 2017 13:12:03 +0000
Resent-Message-Id: <E1dDsYd-0001nq-0d@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 <ylafon@w3.org>) id 1dDsYX-0001mh-6w for ietf-http-wg@listhub.w3.org; Thu, 25 May 2017 13:11:57 +0000
Received: from raoul.w3.org ([128.30.52.128]) by mimas.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <ylafon@w3.org>) id 1dDsYD-0001ht-Jn for ietf-http-wg@w3.org; Thu, 25 May 2017 13:11:51 +0000
Received: from platy.fdn.fr ([80.67.176.7] helo=[192.168.1.36]) by raoul.w3.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ylafon@w3.org>) id 1dDsYC-000FPK-TF for ietf-http-wg@w3.org; Thu, 25 May 2017 13:11:37 +0000
Content-Type: multipart/alternative; boundary="Apple-Mail=_2599C130-AB67-4B2F-B277-8A783F6E715F"
Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\))
From: David Witherspoon <dwitherspoon2011@gmail.com>
Resent-From: Yves Lafon <ylafon@w3.org>
Date: Wed, 24 May 2017 17:27:53 +0000
Resent-Date: Thu, 25 May 2017 15:11:34 +0200
Resent-To: ietf-http-wg@w3.org
Message-Id: <CAGnbNm78FYtC_CU2V+CbBTvP6qPzVgGNXyowoFRK1fw7T=_dDQ@mail.gmail.com>
X-Name-Md5: efe3dad792d606410c9cc49cedaffc94
To: ietf-http-wg@w3.org
X-Mailer: Apple Mail (2.3273)
X-W3C-Hub-Spam-Status: No, score=-1.5
X-W3C-Hub-Spam-Report: ALL_TRUSTED=-1, BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, NML_ADSP_CUSTOM_MED=0.9, RP_MATCHES_RCVD=-0.001, W3C_NW=0.5
X-W3C-Scan-Sig: mimas.w3.org 1dDsYD-0001ht-Jn 5573504e7a16dc53c772a5192d7f6262
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Server Push and Caching
Archived-At: <http://www.w3.org/mid/CAGnbNm78FYtC_CU2V+CbBTvP6qPzVgGNXyowoFRK1fw7T=_dDQ@mail.gmail.com>
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/33951
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>

>  The only native HTTP mechanism for cache invalidation is described in RFC7234, Section 4.4:

I believe this is not entirely correct.  RFC7540 Section 8.2.1: 

   Server push is semantically equivalent to a server responding to a
   request; however, in this case, that request is also sent by the
   server, as a PUSH_PROMISE frame.

Meaning all well-specified semantics of an HTTP request are available to a Push Promise/client-initiated request.  

RFC7234 Section 5.2.1.4 defines one, (request cache-directive, no-cache):

   The “no-cache” request directive indicates that a cache MUST NOT use
   a stored response to satisfy the request without successful
   validation on the origin server.

It would be semantically incorrect to cancel a server-initiated request with a no-cache request directive for the sole reason that it is already has a cached response.  In fact, the premise that a server-initiated request with a no-cache request directive can already have a cached response violates semantic equivalency.  Any request, client or server initiated, with a no-cache request directive can not by RFC have a validated response in the cache.

Assuming the Push Promise goes through (client still may cancel the Push Promise for any reason), this clearly allows for overwriting an existing cached response, specifically replacing a cache entry.

I’m uncertain if there is a response that could complete a push promise in a way to remove a cache entry.  But by SPEC, it seems any server-initiated request (or client initiated request) with a no-cache request directive should invalidate the existing cache entry as soon as that request reaches the caching layer.  Arguably, replacement is a better use case anyways.

Related conversation: https://bugs.chromium.org/p/chromium/issues/detail?id=232040#c75 <https://bugs.chromium.org/p/chromium/issues/detail?id=232040#c75>

> I'm also not convinced that no-cache is the right way to signal invalidation. If the client receives a push promise with no-cache, I would interpret that to mean that all servers between the client and the origin (such as a CDN or reverse proxy between the client and the origin) have ensured that the pushed response is fresh from the origin server. This is what no-cache means: the response has been validated at the origin server. It does *not* mean that the client necessarily has an invalid version of the resource. What if the push promise has no-cache, and we take your idea to not cancel the push, but it turns out the client already has the most up-to-date version of the resource? We wasted time -- we could have canceled the push sooner. Better, IMO, to label the push promise with a conditional header describing the resource so the client can determine if the pushed response is more up-to-date than the resource it has cached. Also see this thread, which I forgot to link earlier:
https://lists.w3.org/Archives/Public/ietf-http-wg/2016JulSep/0522.html <https://lists.w3.org/Archives/Public/ietf-http-wg/2016JulSep/0522.html>

I assume you are referring to intermediaries (CDN/caching) sending push promises independently from the origin server?  From a technical point of view I completely agree with your assertion proxies MUST NOT send a push promise with a no-cache request directive unless they have validated the resource with the origin server.  However, this is the exact same model/flow as response no-cache directives, which is already implemented!  Namely, intermediaries should not replay push promises with a request no-cache directive without validating the cached response, just like it should not serve a cached response with a response no-cache directive without validating it.

> What if the push promise has no-cache, and we take your idea to not cancel the push, but it turns out the client already has the most up-to-date version of the resource? We wasted time -- we could have canceled the push sooner.  Better, IMO, to label the push promise with a conditional header describing the resource so the client can determine if the pushed response is more up-to-date than the resource it has cache.

This problem seems to be generic to the request/response model and cache directives, whether the request is initiated by the browser or by the server.  For example, if a client initiates a request with the no-cache cache directive, then it can be an equal waste of time if the cached response is already in fact valid.  I would hope that any solution to this problem would be generic and solve both cases.  Moreover, I believe existing work in progress (https://tools.ietf.org/html/draft-kazuho-h2-cache-digest-00 <https://tools.ietf.org/html/draft-kazuho-h2-cache-digest-00>) would solve this issue in a generic way AND be more efficient than canceling the push promise because with the proposal the push promise would not be sent in the first place!  



---
- David Witherspoon