Re: [tcpm] Faster application handshakes with SYN/ACK payloads

"Adam Langley" <agl@imperialviolet.org> Sat, 02 August 2008 19:00 UTC

Return-Path: <tcpm-bounces@ietf.org>
X-Original-To: tcpm-archive@megatron.ietf.org
Delivered-To: ietfarch-tcpm-archive@core3.amsl.com
Received: from [127.0.0.1] (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 8E8723A6B05; Sat, 2 Aug 2008 12:00:38 -0700 (PDT)
X-Original-To: tcpm@core3.amsl.com
Delivered-To: tcpm@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 73DE73A6B25 for <tcpm@core3.amsl.com>; Sat, 2 Aug 2008 12:00:31 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.068
X-Spam-Level:
X-Spam-Status: No, score=0.068 tagged_above=-999 required=5 tests=[AWL=-1.943, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, FRT_STOCK2=3.988]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NICE6wdEOdOC for <tcpm@core3.amsl.com>; Sat, 2 Aug 2008 12:00:29 -0700 (PDT)
Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.233]) by core3.amsl.com (Postfix) with ESMTP id 12FBD3A6ABB for <tcpm@ietf.org>; Sat, 2 Aug 2008 12:00:29 -0700 (PDT)
Received: by rv-out-0506.google.com with SMTP id b25so1308823rvf.49 for <tcpm@ietf.org>; Sat, 02 Aug 2008 12:00:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=sNLO0X9rF3JeotVDfitGv7U4gDVRKfVWSGsSdQHJDf0=; b=hlWNOi2PLs6A2hpHPYE+8/3JhxotXrgR8W/PXD9KhqTXClJji2VFgflU9pqppxeZ+Q 5xLyXCFXvfTvn5BZU3EcQWiSr0CyeUF4N5viLHCgqY0lfTu7ZspNC7TdGn4gMPsmSBjE aUxvQc/Gj8zalndzpUgtRu45cpx0AzuDkiMPw=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=M10gj4d0xaLYKYksiq/Ie9p9YQkS8A4U/3DwgNbW3vdrgpXhemHohDSUhSV7YvZ3iT 9CM7Xm0M+pW9MMkW0gXzk+GYUbGzWLhbVIVtsjEYmVvwHkEUa1saRP+GJ/1tzMHL/7Sb BtFItbAGtfiVF9Ed41xe0XcxsCVp7P62A4yV4=
Received: by 10.141.210.13 with SMTP id m13mr6667651rvq.25.1217703650072; Sat, 02 Aug 2008 12:00:50 -0700 (PDT)
Received: by 10.141.186.3 with HTTP; Sat, 2 Aug 2008 12:00:50 -0700 (PDT)
Message-ID: <396556a20808021200u75c3bdd5h77c328a9b61f8d78@mail.gmail.com>
Date: Sat, 2 Aug 2008 12:00:50 -0700
From: "Adam Langley" <agl@imperialviolet.org>
To: "Joe Touch" <touch@isi.edu>
In-Reply-To: <48935337.5060205@isi.edu>
MIME-Version: 1.0
Content-Disposition: inline
References: <396556a20807311252j67b1ab26mf6511dbdae780fdd@mail.gmail.com> <48924496.9060907@isi.edu> <396556a20807311640w2b17d447ud0c51241dc84f682@mail.gmail.com> <48935337.5060205@isi.edu>
X-Google-Sender-Auth: f0614fe3df5b5c25
Cc: tcpm@ietf.org
Subject: Re: [tcpm] Faster application handshakes with SYN/ACK payloads
X-BeenThere: tcpm@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TCP Maintenance and Minor Extensions Working Group <tcpm.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/tcpm>, <mailto:tcpm-request@ietf.org?subject=unsubscribe>
List-Archive: <https://www.ietf.org/mailman/private/tcpm>
List-Post: <mailto:tcpm@ietf.org>
List-Help: <mailto:tcpm-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tcpm>, <mailto:tcpm-request@ietf.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tcpm-bounces@ietf.org
Errors-To: tcpm-bounces@ietf.org

On Fri, Aug 1, 2008 at 11:17 AM, Joe Touch <touch@isi.edu> wrote:
> It's not an experiment; it's valid TCP behavior.

Whenever I'm speaking about an experiment, I mean this draft - it
being "experimental"

> Although there is more detailed feedback below, it might be useful to
> raise this up a level.

Thanks for your detailed response, I fear that there's a
misunderstanding somewhere and that's almost certainly the fault of my
inadequate writeups. Please let me try again:

At the moment, almost no stacks will send payloads in the SYNACK even
though they could as an optimisation. This springs from a few reasons:
  R1) Processing time for a SYN must be minimal to mitigate the
effects of SYN floods. Even waking up an application to process a SYN
would greatly increase the costs.
  R2) Replies to SYNs must be small, otherwise it provides a way to
amplify a DDoS attacks using false source IP addresses.
  R3) The ubiquitous sockets API doesn't make it easy to do so.

I'm proposing that a constant payload (optionally with 8 random bytes)
overcomes R1 and R3. And limiting the size of that payload to 64 bytes
overcomes R2.

There are protocols that could immediately benefit from a gradual
deployment of hosts which supported a setsockopt to set a constant
payload and hosts that would ACK and enqueue such a payload. (I
currently know of no stacks that do either however.) SMTP would be one
such protocol: clients wait for a 200 code banner from the server
before starting their part of the exchange and the banner is small and
constant. SMTP is also a protocol which ends up making many, short
connections.

Additionally, this would also be easy to deploy. For clients that
don't support it, they will ACK only the SYN flag and then the server
knows to include the payload again in the next frame.

However, the sockets API has guided the design of many application
level protocols. Because of this, these protocols are often designed
such that
  * The client starts the exchange: see HTTP
  * The exchange is large, since there's little space pressure: SSH
algorithm agreement uses strings like "diffie-hellman-group14-sha1"
(28 bytes) because of this.

Modifications to take advantage of SYNACK payloads would then require
changes to the application level protocol. This could be managed by
assigning new ports, trying connections on the new ports first,
backing off etc. However, given that this is a partly a latency
optimisation, that's an anathema.

So I additionally define an option that the application layer can set
and query that advertises support for this trick and allows many more
application level protocols to take advantage of it.

So, fundamentally, we end up with an opportunistic experiment that can
provide advantages, but may also have some costs if middleware gets
upset etc, as you note:

> (side note) Such an option might be useful, but might also be an issue.
> It tests the fact that TCPs ignore unknown options, a test that might
> fail. It also tests the fact that middleboxes should pass options
> unmodified, which also might fail.

Because of this, I wanted to make sure that clients were free to retry
a connection without the option in the case that something was
reacting badly to it. Many of the words in the draft are then
dedicated to making sure that both endpoints reach a consistent view
of when this option is in effect. Like the prohibition of not
including the option in a SYNACK if the previous SYNACK included it.
If that were to happen, the endpoint couldn't know which SYNACK the
peer saw and thus wouldn't know if the option was in effect or not.

For all of your comments that I have removed below, I hope that I've
addressed them in the above. If not, please highlight them again and I
will attempt to better do so.

Also, if the above was clearer then I should consider using it in the draft.

To address the remainder of your points:

> A 576 MTU is the smallest size that endpoints agree to reassemble; it is
> NOT the smallest MTU all links agree to support in the Internet. The
> smallest MTU is 68 bytes - i.e., IP with all possible options, TCP with
> none, and the smallest possible fragment (8 bytes) [see RFC791]. As a
> result, a 64-byte payload is too large to assume that it won't be
> fragmented (that may be true practically in many cases, but it isn't a
> requirement).

I don't believe that we should specify this. If a host finds itself in
a situation where the SYNACK payload is problematic in the face of the
MTU it may, validly, choose to fragment or to not echo the option. I
think the implementations have better information about which is the
best course of action.


> |>        - how do you handle simultaneous opens?
> If confirming the option is critical, you need to handle this case. As
> noted above, it might not be critical (or even necessary).

I believe that both sides will end up with a consistent view of
weather the option is in effect (neither will believe it to be so).

> | My hope was that by defining a flags option like this, future options
> | that require only to signal their presence in a SYN could save space.
> That might be a useful to document as a separate issue, since it's
> orthogonal to this option. However, you'd need more rules, like the fact
> that the responder needs to clear (or truncate) all bits it doesn't
> understand or doesn't agree to.

Yes, I'll add that words to that effect.

Looking at the list of currently assigned options, very few of them
are binary flags like this (SACK permitted is the other major one,
"Partial Order Connection Permitted", etc), suggesting that it might
not be worthwhile. As you point out:

> the 25th such flag pays an extra 3-byte penalty when no
> other flags are used.

Which is true. I'm happy with whatever the consensus is.



Cheers

AGL

-- 
Adam Langley agl@imperialviolet.org http://www.imperialviolet.org
_______________________________________________
tcpm mailing list
tcpm@ietf.org
https://www.ietf.org/mailman/listinfo/tcpm