Development issues regarding the cerowrt test router project
 help / color / mirror / Atom feed
From: Christoph Paasch <cpaasch@apple.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "Stuart Cheshire" <cheshire@apple.com>,
	"Bob McMahon" <bob.mcmahon@broadcom.com>,
	"Cake List" <cake@lists.bufferbloat.net>,
	"Valdis Klētnieks" <valdis.kletnieks@vt.edu>,
	Make-Wifi-fast <make-wifi-fast@lists.bufferbloat.net>,
	"David P. Reed" <dpreed@deepplum.com>,
	starlink@lists.bufferbloat.net,
	codel <codel@lists.bufferbloat.net>,
	cerowrt-devel <cerowrt-devel@lists.bufferbloat.net>,
	bloat <bloat@lists.bufferbloat.net>,
	"Steve Crocker" <steve@shinkuro.com>,
	"Vint Cerf" <vint@google.com>
Subject: Re: [Bloat] [Make-wifi-fast] TCP_NOTSENT_LOWAT applied to e2e TCP msg latency
Date: Tue, 26 Oct 2021 11:45:24 -0700	[thread overview]
Message-ID: <4BFB5A37-9574-49BE-B083-FBC1F2B0381E@apple.com> (raw)
In-Reply-To: <0e29e225-9f55-4392-640a-2d27c4c26116@gmail.com>

Hello,

> On Oct 25, 2021, at 9:24 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> 
> 
> 
> On 10/25/21 8:11 PM, Stuart Cheshire via Bloat wrote:
>> On 21 Oct 2021, at 17:51, Bob McMahon via Make-wifi-fast <make-wifi-fast@lists.bufferbloat.net> wrote:
>> 
>>> Hi All,
>>> 
>>> Sorry for the spam. I'm trying to support a meaningful TCP message latency w/iperf 2 from the sender side w/o requiring e2e clock synchronization. I thought I'd try to use the TCP_NOTSENT_LOWAT event to help with this. It seems that this event goes off when the bytes are in flight vs have reached the destination network stack. If that's the case, then iperf 2 client (sender) may be able to produce the message latency by adding the drain time (write start to TCP_NOTSENT_LOWAT) and the sampled RTT.
>>> 
>>> Does this seem reasonable?
>> 
>> I’m not 100% sure what you’re asking, but I will try to help.
>> 
>> When you set TCP_NOTSENT_LOWAT, the TCP implementation won’t report your endpoint as writable (e.g., via kqueue or epoll) until less than that threshold of data remains unsent. It won’t stop you writing more bytes if you want to, up to the socket send buffer size, but it won’t *ask* you for more data until the TCP_NOTSENT_LOWAT threshold is reached.
> 
> 
> When I implemented TCP_NOTSENT_LOWAT back in 2013 [1], I made sure that sendmsg() would actually
> stop feeding more bytes in TCP transmit queue if the current amount of unsent bytes
> was above the threshold.
> 
> So it looks like Apple implementation is different, based on your description ?

Yes, TCP_NOTSENT_LOWAT only impacts the wakeup on iOS/macOS/...

An app can still fill the send-buffer if it does a sendmsg() with a large buffer or does repeated calls to sendmsg().

Fur Apple, the goal of TCP_NOTSENT_LOWAT was to allow an app to quickly change the data it "scheduled" to send. And thus allow the app to write the smallest "logical unit" it has. If that unit is 512KB large, the app is allowed to send that.
For example, in case of video-streaming one may want to skip ahead in the video. In that case the app still needs to transmit the remaining parts of the previous frame anyways, before it can send the new video frame.
That's the reason why the Apple implementation allows one to write more than just the lowat threshold.


That being said, I do think that Linux's way allows for an easier API because the app does not need to be careful at how much data it sends after an epoll/kqueue wakeup. So, the latency-benefits will be easier to get.


Christoph



> [1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=c9bee3b7fdecb0c1d070c7b54113b3bdfb9a3d36
> 
> netperf does not use epoll(), but rather a loop over sendmsg().
> 
> One of the point of TCP_NOTSENT_LOWAT for Google was to be able to considerably increase
> max number of bytes in transmit queues (3rd column of /proc/sys/net/ipv4/tcp_wmem)
> by 10x, allowing for autotune to increase BDP for big RTT flows, this without
> increasing memory needs for flows with small RTT.
> 
> In other words, the TCP implementation attempts to keep BDP bytes in flight + TCP_NOTSENT_LOWAT bytes buffered and ready to go. The BDP of bytes in flight is necessary to fill the network pipe and get good throughput. The TCP_NOTSENT_LOWAT of bytes buffered and ready to go is provided to give the source software some advance notice that the TCP implementation will soon be looking for more bytes to send, so that the buffer doesn’t run dry, thereby lowering throughput. (The old SO_SNDBUF option conflates both “bytes in flight” and “bytes buffered and ready to go” into the same number.)
>> 
>> If you wait for the TCP_NOTSENT_LOWAT notification, write a chunk of n bytes of data, and then wait for the next TCP_NOTSENT_LOWAT notification, that will tell you roughly how long it took n bytes to depart the machine. You won’t know why, though. The bytes could depart the machine in response for acks indicating that the same number of bytes have been accepted at the receiver. But the bytes can also depart the machine because CWND is growing. Of course, both of those things are usually happening at the same time.
>> 
>> How to use TCP_NOTSENT_LOWAT is explained in this video:
>> 
>> <https://developer.apple.com/videos/play/wwdc2015/719/?time=2199>
>> 
>> Later in the same video is a two-minute demo (time offset 42:00 to time offset 44:00) showing a “before and after” demo illustrating the dramatic difference this makes for screen sharing responsiveness.
>> 
>> <https://developer.apple.com/videos/play/wwdc2015/719/?time=2520>
>> 
>> Stuart Cheshire
>> _______________________________________________
>> Bloat mailing list
>> Bloat@lists.bufferbloat.net
>> https://lists.bufferbloat.net/listinfo/bloat
>> 
> _______________________________________________
> Bloat mailing list
> Bloat@lists.bufferbloat.net
> https://lists.bufferbloat.net/listinfo/bloat


  reply	other threads:[~2021-10-26 18:45 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01  0:12 [Cerowrt-devel] Due Aug 2: Internet Quality workshop CFP for the internet architecture board Dave Taht
2021-07-02  1:16 ` David P. Reed
2021-07-02  4:04   ` [Make-wifi-fast] " Bob McMahon
2021-07-02 16:11     ` [Cerowrt-devel] [Starlink] [Make-wifi-fast] " Dick Roy
2021-07-02 17:07   ` [Cerowrt-devel] " Dave Taht
2021-07-02 23:28     ` [Make-wifi-fast] " Bob McMahon
2021-07-06 13:46       ` [Cerowrt-devel] [Starlink] [Make-wifi-fast] " Ben Greear
2021-07-06 20:43         ` [Starlink] [Make-wifi-fast] [Cerowrt-devel] " Bob McMahon
2021-07-06 21:24           ` [Cerowrt-devel] [Starlink] [Make-wifi-fast] " Ben Greear
2021-07-06 22:05             ` [Starlink] [Make-wifi-fast] [Cerowrt-devel] " Bob McMahon
2021-07-07 13:34               ` [Cerowrt-devel] [Starlink] [Make-wifi-fast] " Ben Greear
2021-07-07 19:19                 ` [Starlink] [Make-wifi-fast] [Cerowrt-devel] " Bob McMahon
2021-07-08 19:38         ` [Cerowrt-devel] [Starlink] [Make-wifi-fast] " David P. Reed
2021-07-08 22:51           ` [Starlink] [Make-wifi-fast] [Cerowrt-devel] " Bob McMahon
2021-07-09  3:08           ` [Cerowrt-devel] [Starlink] [Make-wifi-fast] " Leonard Kleinrock
2021-07-09 10:05             ` [Cerowrt-devel] [Make-wifi-fast] [Starlink] " Luca Muscariello
2021-07-09 19:31               ` [Cerowrt-devel] Little's Law mea culpa, but not invalidating my main point David P. Reed
2021-07-09 20:24                 ` Bob McMahon
2021-07-09 22:57                 ` [Bloat] " Holland, Jake
2021-07-09 23:37                   ` Toke Høiland-Jørgensen
2021-07-09 23:01                 ` [Cerowrt-devel] " Leonard Kleinrock
2021-07-09 23:56                   ` [Cerowrt-devel] [Bloat] " Jonathan Morton
2021-07-17 23:56                     ` [Cerowrt-devel] [Make-wifi-fast] " Aaron Wood
2021-07-10 19:51                   ` Bob McMahon
2021-07-10 23:24                     ` Bob McMahon
2021-07-12 13:46                 ` [Bloat] " Livingood, Jason
2021-07-12 17:40                   ` [Cerowrt-devel] " David P. Reed
2021-07-12 18:21                     ` Bob McMahon
2021-07-12 18:38                       ` Bob McMahon
2021-07-12 19:07                       ` [Cerowrt-devel] " Ben Greear
2021-07-12 20:04                         ` Bob McMahon
2021-07-12 20:32                           ` [Cerowrt-devel] " Ben Greear
2021-07-12 20:36                             ` [Cerowrt-devel] [Cake] " David Lang
2021-07-12 20:50                               ` Bob McMahon
2021-07-12 20:42                             ` Bob McMahon
2021-07-13  7:14                             ` [Cerowrt-devel] " Amr Rizk
2021-07-13 17:07                               ` Bob McMahon
2021-07-13 17:49                                 ` [Cerowrt-devel] " David P. Reed
2021-07-14 18:37                                   ` Bob McMahon
2021-07-15  1:27                                     ` Holland, Jake
2021-07-16  0:34                                       ` Bob McMahon
     [not found]                                   ` <A5E35F34-A4D5-45B1-8E2D-E2F6DE988A1E@cs.ucla.edu>
2021-07-22 16:30                                     ` Bob McMahon
2021-07-13 17:22                               ` Bob McMahon
2021-07-17 23:29                             ` [Cerowrt-devel] " Aaron Wood
2021-07-18 19:06                               ` Bob McMahon
2021-07-12 21:54                           ` [Cerowrt-devel] [Make-wifi-fast] " Jonathan Morton
2021-09-20  1:21                 ` [Cerowrt-devel] " Dave Taht
2021-09-20  4:00                   ` Valdis Klētnieks
2021-09-20  4:09                     ` David Lang
2021-09-20 21:30                       ` David P. Reed
2021-09-20 21:44                         ` [Cerowrt-devel] [Cake] " David P. Reed
2021-09-20 12:57                     ` [Cerowrt-devel] [Starlink] " Steve Crocker
2021-09-20 16:36                       ` [Cerowrt-devel] [Cake] " John Sager
2021-09-21  2:40                       ` [Starlink] [Cerowrt-devel] " Vint Cerf
2021-09-23 17:46                         ` Bob McMahon
2021-09-26 18:24                           ` [Cerowrt-devel] [Starlink] " David P. Reed
2021-10-22  0:51                             ` TCP_NOTSENT_LOWAT applied to e2e TCP msg latency Bob McMahon
2021-10-26  3:11                               ` [Make-wifi-fast] " Stuart Cheshire
2021-10-26  4:24                                 ` [Cerowrt-devel] [Bloat] " Eric Dumazet
2021-10-26 18:45                                   ` Christoph Paasch [this message]
2021-10-26 23:23                                     ` Bob McMahon
2021-10-26 23:38                                       ` Christoph Paasch
2021-10-27  1:12                                         ` [Cerowrt-devel] " Eric Dumazet
2021-10-27  3:45                                           ` Bob McMahon
2021-10-27  5:40                                             ` [Cerowrt-devel] " Eric Dumazet
2021-10-28 16:04                                             ` Christoph Paasch
2021-10-29 21:16                                               ` Bob McMahon
2021-10-26  5:32                                 ` Bob McMahon
2021-10-26 10:04                                   ` [Cerowrt-devel] [Starlink] " Bjørn Ivar Teigen
2021-10-26 17:23                                     ` Bob McMahon
2021-10-27 14:29                                       ` [Cerowrt-devel] [Make-wifi-fast] [Starlink] " Sebastian Moeller
2021-08-02 22:59               ` [Make-wifi-fast] [Starlink] [Cerowrt-devel] Due Aug 2: Internet Quality workshop CFP for the internet architecture board Bob McMahon
2021-08-02 23:16                 ` [Cerowrt-devel] [Cake] [Make-wifi-fast] [Starlink] " David Lang
2021-08-02 23:50                   ` [Cake] [Make-wifi-fast] [Starlink] [Cerowrt-devel] " Bob McMahon
2021-08-03  3:06                     ` [Cerowrt-devel] [Cake] [Make-wifi-fast] [Starlink] " David Lang
2021-08-02 23:55                   ` Ben Greear
2021-08-03  0:01                     ` [Cake] [Make-wifi-fast] [Starlink] [Cerowrt-devel] " Bob McMahon
2021-08-03  3:12                       ` [Cerowrt-devel] [Cake] [Make-wifi-fast] [Starlink] " David Lang
2021-08-03  3:23                         ` [Cake] [Make-wifi-fast] [Starlink] [Cerowrt-devel] " Bob McMahon
2021-08-03  4:30                           ` [Cerowrt-devel] [Cake] [Make-wifi-fast] [Starlink] " David Lang
2021-08-03  4:38                             ` [Cake] [Make-wifi-fast] [Starlink] [Cerowrt-devel] " Bob McMahon
2021-08-03  4:44                               ` [Cerowrt-devel] [Cake] [Make-wifi-fast] [Starlink] " David Lang
2021-08-03 16:01                                 ` [Cake] [Make-wifi-fast] [Starlink] [Cerowrt-devel] " Bob McMahon
2021-08-08  4:35                             ` [Cerowrt-devel] [Starlink] [Cake] [Make-wifi-fast] " Dick Roy
2021-08-08  5:04                               ` [Starlink] [Cake] [Make-wifi-fast] [Cerowrt-devel] " Bob McMahon
2021-08-08  5:04                           ` [Cerowrt-devel] [Starlink] [Cake] [Make-wifi-fast] " Dick Roy
2021-08-08  5:07                             ` [Starlink] [Cake] [Make-wifi-fast] [Cerowrt-devel] " Bob McMahon
2021-08-10 14:10                           ` [Cerowrt-devel] [Starlink] [Cake] [Make-wifi-fast] " Rodney W. Grimes
2021-08-10 16:13                             ` Dick Roy
2021-08-10 17:06                               ` [Starlink] [Cake] [Make-wifi-fast] [Cerowrt-devel] " Bob McMahon
2021-08-10 17:56                                 ` [Cerowrt-devel] [Starlink] [Cake] [Make-wifi-fast] " Dick Roy
2021-08-10 18:11                                 ` Dick Roy
2021-08-10 19:21                                   ` [Starlink] [Cake] [Make-wifi-fast] [Cerowrt-devel] " Bob McMahon
2021-08-10 20:16                                     ` [Cerowrt-devel] Anhyone have a spare couple a hundred million ... Elon may need to start a go-fund-me page! Dick Roy
2021-08-10 20:33                                       ` [Cerowrt-devel] [Starlink] " Jeremy Austin
2021-08-10 20:44                                         ` David Lang
2021-08-10 22:54                                           ` Bob McMahon
2021-09-02 17:36                                   ` [Cerowrt-devel] [Cake] [Starlink] [Make-wifi-fast] Due Aug 2: Internet Quality workshop CFP for the internet architecture board David P. Reed
2021-09-03 14:35                                     ` [Bloat] [Cake] [Starlink] [Make-wifi-fast] [Cerowrt-devel] " Matt Mathis
2021-09-03 18:33                                       ` [Cerowrt-devel] [Bloat] [Cake] [Starlink] [Make-wifi-fast] " David P. Reed
2021-08-03  0:37                   ` [Cerowrt-devel] [Cake] [Make-wifi-fast] [Starlink] " Leonard Kleinrock
2021-08-03  1:24                     ` [Cake] [Make-wifi-fast] [Starlink] [Cerowrt-devel] " Bob McMahon
2021-08-08  5:07                       ` [Cerowrt-devel] [Starlink] [Cake] [Make-wifi-fast] " Dick Roy
2021-08-08  5:15                         ` [Starlink] [Cake] [Make-wifi-fast] [Cerowrt-devel] " Bob McMahon
2021-08-08 18:36                           ` [Cerowrt-devel] [Make-wifi-fast] [Starlink] [Cake] " Aaron Wood
2021-08-08 18:48                             ` [Cerowrt-devel] [Bloat] " Jonathan Morton
2021-08-08 19:58                               ` [Bloat] [Make-wifi-fast] [Starlink] [Cake] [Cerowrt-devel] " Bob McMahon
2021-08-08  4:20                     ` [Cerowrt-devel] [Starlink] [Cake] [Make-wifi-fast] " Dick Roy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.bufferbloat.net/postorius/lists/cerowrt-devel.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BFB5A37-9574-49BE-B083-FBC1F2B0381E@apple.com \
    --to=cpaasch@apple.com \
    --cc=bloat@lists.bufferbloat.net \
    --cc=bob.mcmahon@broadcom.com \
    --cc=cake@lists.bufferbloat.net \
    --cc=cerowrt-devel@lists.bufferbloat.net \
    --cc=cheshire@apple.com \
    --cc=codel@lists.bufferbloat.net \
    --cc=dpreed@deepplum.com \
    --cc=eric.dumazet@gmail.com \
    --cc=make-wifi-fast@lists.bufferbloat.net \
    --cc=starlink@lists.bufferbloat.net \
    --cc=steve@shinkuro.com \
    --cc=valdis.kletnieks@vt.edu \
    --cc=vint@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox