Re: HTTP Partial POST Replay

Alan Frindell <afrind@fb.com> Mon, 01 July 2019 16:18 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 94BE41203CE for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 1 Jul 2019 09:18:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.751
X-Spam-Level:
X-Spam-Status: No, score=-2.751 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.25, MAILING_LIST_MULTI=-1, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=fb.com header.b=XfPgU/JD; dkim=pass (1024-bit key) header.d=fb.onmicrosoft.com header.b=OXv+WXfG
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 nIbrrLfQe_Ow for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 1 Jul 2019 09:18:21 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [IPv6:2603:400a:ffff:804:801e:34:0:38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B97C8120342 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Mon, 1 Jul 2019 09:18:07 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.89) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1hhyxz-0004wV-BL for ietf-http-wg-dist@listhub.w3.org; Mon, 01 Jul 2019 16:15:43 +0000
Resent-Date: Mon, 01 Jul 2019 16:15:43 +0000
Resent-Message-Id: <E1hhyxz-0004wV-BL@frink.w3.org>
Received: from titan.w3.org ([2603:400a:ffff:804:801e:34:0:4c]) by frink.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from <prvs=2085d59ec2=afrind@fb.com>) id 1hhyxx-0004sN-5B for ietf-http-wg@listhub.w3.org; Mon, 01 Jul 2019 16:15:41 +0000
Received: from mx0a-00082601.pphosted.com ([67.231.145.42]) by titan.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from <prvs=2085d59ec2=afrind@fb.com>) id 1hhyxv-0007pJ-I3 for ietf-http-wg@w3.org; Mon, 01 Jul 2019 16:15:40 +0000
Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x61G7CJH010688; Mon, 1 Jul 2019 09:14:14 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=OXzVVMX/+k65WVDgYzNIooCwBv3V8LVXYQVZOEMMo6A=; b=XfPgU/JDN65EuueCrgJE9/zVzLDZDWNyYTJSe4Mk8R5M0RIKmSK2PGUxIgoMex/KJhMi oJ+OTgDIjWGPq/sapJSFYgEPHOjqo2Lym0DPiFkbRsWC/geCeoY5RcYNjyVkaH6Fb7B7 gbECQayW9o7AKevspnLlr1HARQy4YI9lUUI=
Received: from mail.thefacebook.com (mailout.thefacebook.com [199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2tfhyague8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 01 Jul 2019 09:14:13 -0700
Received: from prn-hub01.TheFacebook.com (2620:10d:c081:35::125) by prn-hub02.TheFacebook.com (2620:10d:c081:35::126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1713.5; Mon, 1 Jul 2019 09:14:10 -0700
Received: from NAM03-DM3-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1713.5 via Frontend Transport; Mon, 1 Jul 2019 09:14:10 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OXzVVMX/+k65WVDgYzNIooCwBv3V8LVXYQVZOEMMo6A=; b=OXv+WXfGs0Z34vBPyz1xv9NY3CpZrhMgqcsRGkjG4aJPhn1MCUpJ8BdvBWNWeMBBb3u1YjpieM/vwq1xgs8+ZVC30n5d+V5Fs1inMes6Eaz92eVvxCXoaoGIGEYI+bVmQ92+LREZizPhPvvuTUoTWJZU6JwwzhW7659D0yERjic=
Received: from MWHPR15MB1181.namprd15.prod.outlook.com (10.175.9.8) by MWHPR15MB1486.namprd15.prod.outlook.com (10.173.228.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.20; Mon, 1 Jul 2019 16:14:08 +0000
Received: from MWHPR15MB1181.namprd15.prod.outlook.com ([fe80::e9e3:7a6d:bb46:4e15]) by MWHPR15MB1181.namprd15.prod.outlook.com ([fe80::e9e3:7a6d:bb46:4e15%6]) with mapi id 15.20.2008.020; Mon, 1 Jul 2019 16:14:08 +0000
From: Alan Frindell <afrind@fb.com>
To: Amos Jeffries <squid3@treenet.co.nz>, "ietf-http-wg@w3.org" <ietf-http-wg@w3.org>
Thread-Topic: HTTP Partial POST Replay
Thread-Index: AQHVLdu2Q7k3G2uA3Eid3uyhFbvcFaayy8OAgAKzLQA=
Date: Mon, 01 Jul 2019 16:14:08 +0000
Message-ID: <5A755881-F0C0-4E68-AA21-98E423BD0B1C@fb.com>
References: <BCDF2644-1D6A-40FF-9AF7-7FA26A57E3A9@fb.com> <948e26e8-ce3d-894a-17f6-fb17194a37b8@treenet.co.nz>
In-Reply-To: <948e26e8-ce3d-894a-17f6-fb17194a37b8@treenet.co.nz>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
user-agent: Microsoft-MacOutlook/10.1a.0.190609
x-originating-ip: [2620:10d:c090:200::3:9295]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: f35b76ba-10aa-43aa-0d5d-08d6fe3f2592
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:MWHPR15MB1486;
x-ms-traffictypediagnostic: MWHPR15MB1486:
x-microsoft-antispam-prvs: <MWHPR15MB1486C33710ABE6C1840A87B4A7F90@MWHPR15MB1486.namprd15.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:10000;
x-forefront-prvs: 00851CA28B
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(376002)(396003)(346002)(136003)(39860400002)(189003)(199004)(36756003)(305945005)(110136005)(46003)(58126008)(2906002)(7736002)(6246003)(8676002)(8936002)(86362001)(81156014)(53936002)(316002)(5660300002)(64756008)(68736007)(478600001)(81166006)(6506007)(66446008)(256004)(102836004)(33656002)(6436002)(6116002)(6512007)(14444005)(25786009)(99286004)(2616005)(476003)(229853002)(6486002)(14454004)(446003)(11346002)(486006)(186003)(73956011)(76176011)(66946007)(66556008)(66476007)(76116006)(3480700005)(2501003)(71190400001)(71200400001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR15MB1486; H:MWHPR15MB1181.namprd15.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1;
received-spf: None (protection.outlook.com: fb.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: IPXwVgn98BaDHLaj5bX9SL7RLF8b8cC95ib4mF2ysaW+ieHb8mRgKwFg6idhUmXayESWwRKvHTx6ThpJfkXqo9jcDcPJQnNzdFLxbmb/wig1J5N/1QyScxoOXfKRSVnFBbG2KVTKUNUg5fzDpWQ5mDEAxy4g0+s+NcLHXa+88LvhAo3hQvWDl4Jy/K4NuQGG0ZHa+So/tXmSK9eE+wS9MzYKId1GRkHu0xZx5ZqNwpUKQjnze1o8W6/NHJzevOpxja3fpdQExTGTuVQF5f5z1N3qAoOlVdHwP+3l10aMAl5Zc1v/NClMLZ9n0DMGfuG6ivG3qi0S8wgP3QR36ohzg2KkvqHHqNj7l4fR4UeEJcckgh/kQEz1jgMps94sKtLmpOG3S3zZLQeZgmSX8KHFyVgk1fWquKarNCzwZ7OA6P4=
Content-Type: text/plain; charset="utf-8"
Content-ID: <F8509382568F4C4BB719857B85004D17@namprd15.prod.outlook.com>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: f35b76ba-10aa-43aa-0d5d-08d6fe3f2592
X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jul 2019 16:14:08.4675 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: afrind@fb.com
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1486
X-OriginatorOrg: fb.com
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-01_10:, , signatures=0
X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907010193
X-FB-Internal: deliver
Received-SPF: pass client-ip=67.231.145.42; envelope-from=prvs=2085d59ec2=afrind@fb.com; helo=mx0a-00082601.pphosted.com
X-W3C-Hub-Spam-Status: No, score=-4.8
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: titan.w3.org 1hhyxv-0007pJ-I3 39b9c45258066d918519ba4e0bbcb347
X-Original-To: ietf-http-wg@w3.org
Subject: Re: HTTP Partial POST Replay
Archived-At: <https://www.w3.org/mid/5A755881-F0C0-4E68-AA21-98E423BD0B1C@fb.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/36738
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: <https://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

Thanks for taking the time to read and comment.  My responses are inline.
    
    Overall impression is that this is a overly complex and resource
    expensive replacement for the very simple 307 status mechanism. There is
    no harm in telling a client it has to retry its reuqest.

I disagree that there is no harm in asking the client to retry the request.  In our case, the intermediary (load balancing reverse proxy), is < 1 millisecond away from the server, but hundreds of milliseconds away from the client.  Further, the client may be charged for bandwidth, and the client may have already spent a fair amount of time/bandwidth transmitting the request.  I agree with you that for a generic intermediary or forward proxy, particularly one very close to the client, the feature doesn't make as much sense.  I can clarify that in the draft.

Also, I should mention in the draft that the server can 307 rather than abort requests it cannot complete at shutdown time.
            
    * The stated case of "server wants to shutdown" does not correlate well
    with the fact that to use this mechanism the server has to store and
    re-deliver all the initial request bandwidth back to the intermediary.

Again, because the server and intermediary are close together, replaying the partial request doesn't prevent the server from shutting down.  The type of server and size of a typical request can also make a difference: we use this primary for dynamic web traffic (as opposed to something like video upload).  These dynamic requests tend not to be huge, and the web server was already holding the entire POST body in memory before dispatching it to the handler.
    
    * That re-sending is where the bandwidth issue is coming from. The
    initial request uses N bytes to arrive from the client, if M of those
    are a) delivered to each of D servers and b) received back from the
    initial D-1 servers, and c) deliver to the second server. That makes a
    total bandwidth consumption of (N + (D-1)*M).
      Whereas with 307 only consumes (N + M).

It seems you are only counting proxy to server bandwidth.  Assuming the intermediary cannot buffer the body, and a 307 triggers the client to resend the entire request, that will consume 2*N + (N + M) or (3*N + M), compared to N + (N + (D-1)*M) or (2*N + (D-1)*M).  
    
    Also keep in mind that even a blind intermediary just pushing data to a
    single server is handling twice the traffic that server does. That is
    the minimum best-case situation. With multiple servers and/or clients
    the difference increases rapidly to orders of magnitude more resource
    consumption. That is the existing situation, before this feature even
    starts to force more resource consumption.
    
We find that only a fraction of requests in progress at shutdown time are POST requests, and of those, an even smaller fraction have incomplete bodies say 1 second after shutdown is initiated.  The number of requests that get redirected in this manner from single server in our deployment (which spans hundreds of thousands of servers) is relatively small.  Though, we do find that a tiny number get quite unlucky during a web tier restart and get replayed a few times.
    
    * All this re-sending of data could delay the server shutdown an
    unreasonable amount of time. Turning what would be a few seconds into
    minutes or even hours. Depending on the intermediary load being
    reasonable is not a good idea.

I agree with you that in a completely generic and blind case, this is a problem.  In our deployment, we find this feature does not impact shutdown time of the webserver, which is 10-15 seconds.   
    
    * Every millisecond of delay added by the re-receive and re-send of data
    makes it more likely the client will terminate early. If that happens
    all this time, bandwidth, memory, and CPU cycles spent are completely
    wasted.
    
This is precisely the reason I feel this is a valuable feature.  If the client must resend the entire request it's likely to take even longer.

    Consider the case of a system which is undergoing a DoS at the
    public-facing interface of the intermediary. Enacting this feature is a
    huge resource expenditure for an already highly loaded intermediary.
    
If a system is undergoing DoS, I expect it to be able to jettison less critical functions to save resources.  Such an intermediary could always convert a partial POST replay into a 307 or 500, and reset the upstream request.  I can add this to the security considerations.    
    
    * Section 2.1 says "The server MUST have prior knowledge"
    
    Yet no mechanism(s) are even hinted at how a server may acquire such
    knowledge. Defining a specific negotiation signal would be far better
    for this and avoid a huge headache with implementations choosing
    different signals and mechanisms for negotiating that knowledge.
 
I agree.  I will elaborate in the draft on feature negotiation.  We set this up out of band by configuring the proxies and servers to use this feature.  H2 or H3 SETTINGS are appropriate to announce the support for the feature, but H1 would most likely need to add a header to each request indicating support. 
      
    * The Echo- or Pseudo-Echo mechanism is very clunky. I believe it to be
    unlikely that any intermediary implementing this feature is unable to
    simply store the initial request headers for re-use as needed.
    
That is valuable feedback.  Our implementation stores the initial request headers, but I didn't know if that was a valid assumption, so I added the Echo- mechanism to the draft.  I can remove it entirely and make it a requirement that the request be stored to use the feature.

Thanks

-Alan