From nobody Thu Jul 18 14:02:14 2024 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WPvdL0yysz5RTtR for ; Thu, 18 Jul 2024 14:02:30 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WPvdK2Kktz44qD; Thu, 18 Jul 2024 14:02:29 +0000 (UTC) (envelope-from asomers@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freebsd.org (policy=none); spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.161.53 as permitted sender) smtp.mailfrom=asomers@gmail.com Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5ce739c2650so437928eaf.1; Thu, 18 Jul 2024 07:02:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721311348; x=1721916148; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=biDhjVlSlGYuJF3U027WFtvxNX7E00DlTuXBjCgbZqU=; b=v5emZPz7pbTDPl+ie6++Ago4mVsKdR+nud7iYGEEGtNe62WruqAQh61OONLYtpVk7M BTbcLLIiHpvduFVYHNrqmSj5Ktgh84/VgRTyHzGFpaa97EenPpX4iVux+hX5HiLDiu+b VguHkLePBlz2cUbIVtQpjVLAqzWGaqI7hw1U3QyWGm6E6ULqp+fLSzioEEaDitpAP6mF bfPOYiIvnndT1lcVaRJfbRvRrzNRXq4axkn+pnWtIF6tXZIKfggcXzWeQF/Xx/By7Re5 nE5etlHF+O52/srPB2CAXHNondL4OhluhEiQe0OBTQD3XcsFlxn/2dEZeEuYztJ+gJxQ kKuQ== X-Forwarded-Encrypted: i=1; AJvYcCVHcLEpCVQCjogGg3C475l7AkzEq8MIY+72eeXstEHO1Kma0fY18eAOMcR4372QKU1jzE6xSBDHULVnhXrpgNrI1uTLlEcgSA== X-Gm-Message-State: AOJu0YyN6SgcyV1cP4HXFeCFCfQBSUO7E203xy6pDSKjMppMNoh9JdvO iUC86MxZvw/4es6y3CQAHlnocp+iZHqR6nBIyH7FGVrRnwsRZ4zHA5VPwFiASHEeZ6pl52899FD 83uibaUGr+r9+fZlqVGkDwNFofyWtyw== X-Google-Smtp-Source: AGHT+IE2qEWsonK/N+Ih61FK6NB+KWDoDQtqypO5tKWWZcsGYsz2cB3+ecZo+BLtUKxT4+mPpL1NQnutrhl+SGjPMj4= X-Received: by 2002:a05:6358:e48b:b0:1ab:f2b3:f018 with SMTP id e5c5f4694b2df-1aca9c3b0eemr256219555d.0.1721311346598; Thu, 18 Jul 2024 07:02:26 -0700 (PDT) List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 References: In-Reply-To: From: Alan Somers Date: Thu, 18 Jul 2024 08:02:14 -0600 Message-ID: Subject: Re: TCP Success Story (was Re: TCP_RACK, TCP_BBR, and firewalls) To: Junho Choi Cc: tuexen@freebsd.org, FreeBSD Net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.50 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.82)[-0.822]; NEURAL_HAM_MEDIUM(-0.68)[-0.680]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RWL_MAILSPIKE_GOOD(-0.10)[209.85.161.53:from]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_TO(0.00)[gmail.com]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MLMMJ_DEST(0.00)[freebsd-net@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; MISSING_XM_UA(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_RCPT(0.00)[]; FREEFALL_USER(0.00)[asomers]; RCVD_IN_DNSWL_NONE(0.00)[209.85.161.53:from] X-Rspamd-Queue-Id: 4WPvdK2Kktz44qD I'm not sure what you're asking. BBR and RACK are two different algorithms that accomplish the same thing. It wouldn't make sense to use both on the same socket at the same time. On Thu, Jul 18, 2024 at 7:01=E2=80=AFAM Junho Choi w= rote: > > Alan - this is a great result to see. Thanks for experimenting. > > Just curious why bbr and rack don't co-exist? Those are two separate thin= gs. > Is it a current bug or by design? > > BR, > > On Thu, Jul 18, 2024 at 5:27=E2=80=AFAM wrote: >> >> > On 17. Jul 2024, at 22:00, Alan Somers wrote: >> > >> > On Sat, Jul 13, 2024 at 1:50=E2=80=AFAM wrote: >> >> >> >>> On 13. Jul 2024, at 01:43, Alan Somers wrote: >> >>> >> >>> I've been experimenting with RACK and BBR. In my environment, they >> >>> can dramatically improve single-stream TCP performance, which is >> >>> awesome. But pf interferes. I have to disable pf in order for them >> >>> to work at all. >> >>> >> >>> Is this a known limitation? If not, I will experiment some more to >> >>> determine exactly what aspect of my pf configuration is responsible. >> >>> If so, can anybody suggest what changes would have to happen to make >> >>> the two compatible? >> >> A problem with same symptoms was already reported and fixed in >> >> https://reviews.freebsd.org/D43769 >> >> >> >> Which version are you using? >> >> >> >> Best regards >> >> Michael >> >>> >> >>> -Alan >> > >> > TLDR; tcp_rack is good, cc_chd is better, and tcp_bbr is best >> > >> > I want to follow up with the list to post my conclusions. Firstly >> > tuexen@ helped me solve my problem: in FreeBSD 14.0 there is a 3-way >> > incompatibility between (tcp_bbr || tcp_rack) && lro && pf. I can >> > confirm that tcp_bbr works for me if I either disable LRO, disable PF, >> > or switch to a 14.1 server. >> > >> > Here's the real problem: on multiple production servers, downloading >> > large files (or ZFS send/recv streams) was slow. After ruling out >> > many possible causes, wireshark revealed that the connection was >> > suffering about 0.05% packet loss. I don't know the source of that >> > packet loss, but I don't believe it to be congestion-related. Along >> > with a 54ms RTT, that's a fatal combination for the throughput of >> > loss-based congestion control algorithms. According to the Mathis >> > Formula [1], I could only expect 1.1 MBps over such a connection. >> > That's actually worse than what I saw. With default settings >> > (cc_cubic), I averaged 5.6 MBps. Probably Mathis's assumptions are >> > outdated, but that's still pretty close for such a simple formula >> > that's 27 years old. >> > >> > So I benchmarked all available congestion control algorithms for >> > single download streams. The results are summarized in the table >> > below. >> > >> > Algo Packet Loss Rate Average Throughput >> > vegas 0.05% 2.0 MBps >> > newreno 0.05% 3.2 MBps >> > cubic 0.05% 5.6 MBps >> > hd 0.05% 8.6 MBps >> > cdg 0.05% 13.5 MBps >> > rack 0.04% 14 MBps >> > htcp 0.05% 15 MBps >> > dctcp 0.05% 15 MBps >> > chd 0.05% 17.3 MBps >> > bbr 0.05% 29.2 MBps >> > cubic 10% 159 kBps >> > chd 10% 208 kBps >> > bbr 10% 5.7 MBps >> > >> > RACK seemed to achieve about the same maximum bandwidth as BBR, though >> > it took a lot longer to get there. Also, with RACK, wireshark >> > reported about 10x as many retransmissions as dropped packets, which >> > is suspicious. >> > >> > At one point, something went haywire and packet loss briefly spiked to >> > the neighborhood of 10%. I took advantage of the chaos to repeat my >> > measurements. As the table shows, all algorithms sucked under those >> > conditions, but BBR sucked impressively less than the others. >> > >> > Disclaimer: there was significant run-to-run variation; the presented >> > results are averages. And I did not attempt to measure packet loss >> > exactly for most runs; 0.05% is merely an average of a few selected >> > runs. These measurements were taken on a production server running a >> > real workload, which introduces noise. Soon I hope to have the >> > opportunity to repeat the experiment on an idle server in the same >> > environment. >> > >> > In conclusion, while we'd like to use BBR, we really can't until we >> > upgrade to 14.1, which hopefully will be soon. So in the meantime >> > we've switched all relevant servers from cubic to chd, and we'll >> > reevaluate BBR after the upgrade. >> Hi Alan, >> >> just to be clear: the version of BBR currently implemented is >> BBR version 1, which is known to be unfair in certain scenarios. >> Google is still working on BBR to address this problem and improve >> it in other aspects. But there is no RFC yet and the updates haven't >> been implemented yet in FreeBSD. >> >> Best regards >> Michael >> > >> > [1]: https://www.slac.stanford.edu/comp/net/wan-mon/thru-vs-loss.html >> > >> > -Alan >> >> > > > -- > Junho Choi | https://saturnsoft.net