Re: HTTP Partial POST Replay

Matthew Stock <stock@csgeeks.org> Mon, 01 July 2019 16:33 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 ED8A112027A for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 1 Jul 2019 09:33:02 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.65
X-Spam-Level:
X-Spam-Status: No, score=-2.65 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001, MAILING_LIST_MULTI=-1, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=csgeeks-org.20150623.gappssmtp.com
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 LKleKb06nI_g for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 1 Jul 2019 09:33:01 -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 CEFD9120144 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Mon, 1 Jul 2019 09:33:00 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.89) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1hhzCx-0006nU-C1 for ietf-http-wg-dist@listhub.w3.org; Mon, 01 Jul 2019 16:31:11 +0000
Resent-Date: Mon, 01 Jul 2019 16:31:11 +0000
Resent-Message-Id: <E1hhzCx-0006nU-C1@frink.w3.org>
Received: from mimas.w3.org ([2603:400a:ffff:804:801e:34:0:4f]) by frink.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from <stock@csgeeks.org>) id 1hhzCw-0006mf-65 for ietf-http-wg@listhub.w3.org; Mon, 01 Jul 2019 16:31:10 +0000
Received: from mail-yw1-xc2a.google.com ([2607:f8b0:4864:20::c2a]) by mimas.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from <stock@csgeeks.org>) id 1hhzCt-0003tk-Ez for ietf-http-wg@w3.org; Mon, 01 Jul 2019 16:31:09 +0000
Received: by mail-yw1-xc2a.google.com with SMTP id t2so181366ywe.10 for <ietf-http-wg@w3.org>; Mon, 01 Jul 2019 09:30:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=csgeeks-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0bG1lco2Or/A8XUN1/gBBMSUURstC2Qhk0/lVV0ZuHA=; b=Qs3lmihCKy16VqRepTZ0mHZTtDsFLWPjha5QKoyhAPbxDGFkbebp52m7nJRUrjlusH BtZ4Ayra2W90+Bfkl2c9phtv6j0rb4+N1Hp8s/qV8L6OPZI4k0PGayf7CYDWL4Y1Nc5A fEvRZCU0yCztqRNydJaV+7xT4mgRfpHkAUpa/bddae0T+BsEIUTSk9/64MeEnOuRl1fL h/Vk/6gwqp4UiRG5jtlf1anVXOH1ak6FITDP97TDI4E9tel904WzCuNEqvXM0x5jbrSw trU4jUR8JP5jPiLsLSkgpZSJmh12t3YU9lyi4ZBjGgHWc45HspOZsMPl7yUDD8iV74g2 Sqgg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0bG1lco2Or/A8XUN1/gBBMSUURstC2Qhk0/lVV0ZuHA=; b=ixBXB26IcGjyMrMPshR/IC0jRRnCEEboXt3bABoJ5QvRztJii9WcrQTDqBYN3h+icI 3lf2YMOqYb19BA7+aZhrpPxhqgUepAYW0dloD/8P68d7fea4/SrAB6Hha9kG5L6KvHOW Ql11ZXBSKTqltQKFBvN8pElrQA/m+L7TkBf9i0PjgBFKpZSlcQgAu7ECnsz/Ld1brKua Ed6xUB2qDv4BLVOO2ubg3SlhzEmckFgW4KMqpoeiJ22F8mhQ49syRYeeq3K57achSEy9 BRlC2mTikz3GjxMXXAbYjcfxtwYEzvp4WW6vv4RByZpR+W1Mocp9hlnpx65wwVGyV37J 2gDw==
X-Gm-Message-State: APjAAAXPB5/hCgb0DChcrLEoRTN6o370ghpoNAr4q33arZ3UavY3LyBI U/4Q3MPUJQwkB/No8kJyy+tF0T9UJ1XCGY/VA67xXA==
X-Google-Smtp-Source: APXvYqxFf7yAoE8tKGHi2q7oSh0t70ahLl3ZfSrQ5oMDancsz5HyZAum7Vti1i6LEtlW8ZooOIoKis6QdZAFweGSXXU=
X-Received: by 2002:a0d:e80d:: with SMTP id r13mr14576651ywe.315.1561998645695; Mon, 01 Jul 2019 09:30:45 -0700 (PDT)
MIME-Version: 1.0
References: <BCDF2644-1D6A-40FF-9AF7-7FA26A57E3A9@fb.com> <948e26e8-ce3d-894a-17f6-fb17194a37b8@treenet.co.nz> <5A755881-F0C0-4E68-AA21-98E423BD0B1C@fb.com>
In-Reply-To: <5A755881-F0C0-4E68-AA21-98E423BD0B1C@fb.com>
From: Matthew Stock <stock@csgeeks.org>
Date: Mon, 01 Jul 2019 12:30:38 -0400
Message-ID: <CAJEih4_-wV1CwJPudoMdA1p=qrqAWuo9zTdfoH=RFJq8EK_fgg@mail.gmail.com>
To: Alan Frindell <afrind@fb.com>
Cc: "ietf-http-wg@w3.org" <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="0000000000006aad47058ca126bd"
Received-SPF: none client-ip=2607:f8b0:4864:20::c2a; envelope-from=stock@csgeeks.org; helo=mail-yw1-xc2a.google.com
X-W3C-Hub-Spam-Status: No, score=-3.9
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: mimas.w3.org 1hhzCt-0003tk-Ez 4d8ebf526070a986dcd2bc9d6eefd20d
X-Original-To: ietf-http-wg@w3.org
Subject: Re: HTTP Partial POST Replay
Archived-At: <https://www.w3.org/mid/CAJEih4_-wV1CwJPudoMdA1p=qrqAWuo9zTdfoH=RFJq8EK_fgg@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/36739
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>

Hi Alan,

If I assume the use case as you describe, where the RTT between the proxy
and the server is tiny, and that the transactions are small, doesn't that
mean it would be better to just let any existing requests complete before
shutting down?  It seems like a better strategy would be to eliminate new
requests to the new instance (e.g. changing the routing at the proxy) and
then wait until all existing (short) requests are completed.  There are
some corner cases, but that seems more straightforward.  In the restart
case, you could have the new instance on the server take over accepting new
requests while the old instance stays active to resolve those that are open.

Matt


On Mon, Jul 1, 2019 at 12:18 PM Alan Frindell <afrind@fb.com> wrote:

> 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
>
>