Re: [Taps] API design: dependencies or buffer control?

Michael Welzl <michawe@ifi.uio.no> Mon, 13 November 2017 02:08 UTC

Return-Path: <michawe@ifi.uio.no>
X-Original-To: taps@ietfa.amsl.com
Delivered-To: taps@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 10265127909 for <taps@ietfa.amsl.com>; Sun, 12 Nov 2017 18:08:48 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.201
X-Spam-Level:
X-Spam-Status: No, score=-4.201 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, 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 VM3NxNf6n6a5 for <taps@ietfa.amsl.com>; Sun, 12 Nov 2017 18:08:45 -0800 (PST)
Received: from mail-out02.uio.no (mail-out02.uio.no [IPv6:2001:700:100:8210::71]) (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 B51A3126CB6 for <taps@ietf.org>; Sun, 12 Nov 2017 18:08:45 -0800 (PST)
Received: from mail-mx02.uio.no ([129.240.10.43]) by mail-out02.uio.no with esmtp (Exim 4.82_1-5b7a7c0-XX) (envelope-from <michawe@ifi.uio.no>) id 1eE4B1-000Aef-P4; Mon, 13 Nov 2017 03:08:43 +0100
Received: from dhcp-9539.meeting.ietf.org ([31.133.149.57]) by mail-mx02.uio.no with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) user michawe (Exim 4.82_1-5b7a7c0-XX) (envelope-from <michawe@ifi.uio.no>) id 1eE4B0-000BUx-U7; Mon, 13 Nov 2017 03:08:43 +0100
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\))
From: Michael Welzl <michawe@ifi.uio.no>
In-Reply-To: <98F9BFDF-0343-4846-A0F8-F3AF60168B5A@apple.com>
Date: Mon, 13 Nov 2017 10:08:38 +0800
Cc: "taps@ietf.org" <taps@ietf.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <D64CF7F6-D8BB-497E-8AAA-6F9A6B86E321@ifi.uio.no>
References: <CF0546DA-422B-4AA3-A593-1BC133AD730D@ifi.uio.no> <A19AC4F5-1A56-4F9B-A5C2-3643CD57FBC1@apple.com> <7F6D4FB0-3D41-4E06-BD11-54D897FA5345@ifi.uio.no> <3702C080-9EEA-441C-96C3-5A2A1FCC7ABA@apple.com> <B543F7E4-2327-4CAE-8707-0F61BE6DD655@ifi.uio.no> <4EF62BB5-7638-4C3D-98A6-F1F081ABF216@ifi.uio.no> <98F9BFDF-0343-4846-A0F8-F3AF60168B5A@apple.com>
To: Tommy Pauly <tpauly@apple.com>
X-Mailer: Apple Mail (2.3273)
X-UiO-SPF-Received: Received-SPF: neutral (mail-mx02.uio.no: 31.133.149.57 is neither permitted nor denied by domain of ifi.uio.no) client-ip=31.133.149.57; envelope-from=michawe@ifi.uio.no; helo=dhcp-9539.meeting.ietf.org;
X-UiO-Spam-info: not spam, SpamAssassin (score=-5.0, required=5.0, autolearn=disabled, AWL=0.050, UIO_MAIL_IS_INTERNAL=-5, uiobl=NO, uiouri=NO)
X-UiO-Scanned: DA09234ADCA038F933594423A5F4434536F36961
Archived-At: <https://mailarchive.ietf.org/arch/msg/taps/PWHM6eH2b-xBJBY824yUkgGt29k>
Subject: Re: [Taps] API design: dependencies or buffer control?
X-BeenThere: taps@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "IETF Transport Services \(TAPS\) Working Group" <taps.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/taps>, <mailto:taps-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/taps/>
List-Post: <mailto:taps@ietf.org>
List-Help: <mailto:taps-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/taps>, <mailto:taps-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 13 Nov 2017 02:08:48 -0000

> On Nov 13, 2017, at 7:54 AM, Tommy Pauly <tpauly@apple.com> wrote:
> 
> The code I work with does TCP_NOTSENT_LOWAT by default, so we have a fair amount of experience with it.

I figured  :-)   AFAIK think Stuart invented it…


> If you're using sockets with TCP_NOTSENT_LOWAT, and you're doing asynchronous non-blocking socket operations, then you don't have the annoyance of getting these "empty" callbacks you're referring to—it just changes how aggressively the writable event fires, making it back off a bit.

Ah, ok, sure.


> With a Post-like API, having something directly like TCP_NOTSENT_LOWAT doesn't make much sense. Instead, the implementation may internally use that, but the equivalent application feedback is the completion that is returned based on the write messages. The timing of when the stack indicates when something has been written allows the application to understand the back-pressure properties of the transport, and if it able to generate or fetch data more slowly to match the back-pressure, it can. Otherwise, it can simply keep writing and the data will get enqueued within the library.

I mean, the way you describe it here, the application has no means to say how much it wants the layers below to buffer. I think that would be useful, no?
A big buffer is more convenient (based on the number write returns), a smaller buffer lets the application have control over the data until the last minute.
But then, doesn’t this amount to the same "nuisance vs. control of data until the last minute" trade-off that I described?


> Dependencies between the messages that are being written, then, doesn't actually come into play much here. Dependencies are hints to the implementation and protocol stack of how to order work when scheduling to send (PRE-WRITE). TCP_NOTSENT_LOWAT or the completions to indicate that writes have completed are all about signaling back to the application to provide back-pressure (POST-WRITE).

I understand the functionality is separate, but you can achieve the same with it: from an application’s point of view, if I have blocks with dependencies and if you allow me to tune the buffer below the write call, then I can decide until the last minute that I’d rather not send a certain data block.

I guess additionally offering to describe dependencies doesn’t hurt anyway, btw … what made me worried about the complexity is the possibility that these dependencies would change over time, and then the application would want to send an update to post-sockets.  I guess the easy way out is not to offer such dynamics (as indeed in this case an application might be better off handling it in the way I describe above?).

Cheers,
Michael