<story><title>Fixing bufferbloat on your home network with OpenBSD 6.2 or newer</title><url>https://pauladamsmith.com/blog/2018/07/fixing-bufferbloat-on-your-home-network-with-openbsd-6.2-or-newer.html</url></story><parent_chain></parent_chain><comment><author>Animats</author><text>It&amp;#x27;s discouraging to me that, 33 years after I first identified this problem [1], there are no good solutions in wide use.&lt;p&gt;Informally, the basic problem is that pure datagram networks with no backpressure, which describes the Internet, handle congestion badly. A big first-in, first-out queue at a choke point works especially badly. That&amp;#x27;s &amp;quot;bufferbloat&amp;quot;.&lt;p&gt;Back in 1985, I proposed &amp;quot;fair queuing&amp;quot; (a term I coined) as a step to a solution.
Fair queuing is simply identifying &amp;quot;flows&amp;quot; (packets with the same endpoints, which may be 
IP addresses or TCP&amp;#x2F;UDP ports), giving them individual queues, and servicing the queues fairly.  I also proposed making TCP congestion-aware, a new idea at the time.[2] That was enough to deal with the problems of the 1980s and 1990s.  I did not forsee a future where people would be trying to run Netflix, Fortnite, and VoIP on the same cable modem connection at the same time.&lt;p&gt;The Internet works only because most of the congestion is at the edges, where the user&amp;#x27;s LAN feeds an ISP connection with less bandwidth than LAN. Most packets are lost there. If they&amp;#x27;re lost further upstream (say at the cable headend), the problems are much worse. We still can&amp;#x27;t deal with congestion in the middle of the network. Fortunately, fiber optic bulk bandwidth is cheap enough to prevent that from being the big bottleneck.&lt;p&gt;Most of the &amp;quot;bufferbloat&amp;quot; aftermarket fixes work by assuming the ISP connection has a fixed data capacity. So the user-side gear does rate-limiting, reordering, and dropping packets to handle congestion locally, to prevent the dumb FIFO queue in the ISP&amp;#x27;s edge router from building up. This can work if the ISP connection has constant outgoing bandwidth. If that varies, as on an overloaded cable segment, there&amp;#x27;s going to be trouble. And, of course, the ISP connection doesn&amp;#x27;t tell the user side nodes it&amp;#x27;s congested. So there&amp;#x27;s a lot of guessing and tweaking involved, which is why none of these fixes Just Work.&lt;p&gt;There are two levels of troublesome FIFO queue - within each host on the LAN, and at the router that connects to the ISP link. Each host has to decide what to send first. The default is FIFO, which, as noted, sucks. Then the router has to decide which packets from which local nodes to send up the ISP link first.  Most ISP-provided routers are still FIFO, although some are more intelligent. A basic property of FIFO queues is that the one who sends the most wins. The nice guys who aren&amp;#x27;t blasting stuff up the pipe get squeezed out. This is why your VoIP stutters.&lt;p&gt;So there&amp;#x27;s a trend towards front-ending the ISP&amp;#x27;s router with another box to do traffic-shaping, which means reordering and dropping packets. That&amp;#x27;s what this article is about. 
There are commercial &amp;quot;gamer routers&amp;quot; which do this, and firmware for various routers.&lt;p&gt;Now, with the ability to shape the traffic, the question is what to do.  Basic fair queuing prevents a big stream from squeezing out a small stream. That&amp;#x27;s step one, and that&amp;#x27;s what the parent article is talking about. He&amp;#x27;s stopped Speed Test from squeezing out his pings.&lt;p&gt;But that may not be enough.  If one node is frantically making large numbers of short HTTP connections, the usual case for an ad-heavy and tracker heavy web page, those may all look like separate flows to the router and get a big fraction of the bandwidth. That&amp;#x27;s no good. 
Now you have to start defining policy rules, which is a huge pain.&lt;p&gt;Some of the &amp;quot;gamer routers&amp;quot; come with policy rules that know too much about specific games. Move and shoot packets get priority over texture updates.  It&amp;#x27;s often enough to prioritize UDP packets over TCP until a UDP flow hits some relatively low bandwidth limit.  If you can give a game low latency for the most important 5% of its traffic, it will often play well.&lt;p&gt;Arguably, each host on the local network should prioritize its own outgoing traffic, leaving the next router upstream to deal with prioritization between nodes. But that requires each node to know something about what the next router upstream is doing. There&amp;#x27;s no mechanism for this. All players are guessing what the other players are doing by observing round trip time and latency.
They don&amp;#x27;t talk to each other about this.&lt;p&gt;And that is why this area is still a mess.&lt;p&gt;John Nagle&lt;p&gt;[1] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;tools.ietf.org&amp;#x2F;html&amp;#x2F;rfc970&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;tools.ietf.org&amp;#x2F;html&amp;#x2F;rfc970&lt;/a&gt;
[2] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;tools.ietf.org&amp;#x2F;html&amp;#x2F;rfc896&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;tools.ietf.org&amp;#x2F;html&amp;#x2F;rfc896&lt;/a&gt;</text></comment>
<story><title>Fixing bufferbloat on your home network with OpenBSD 6.2 or newer</title><url>https://pauladamsmith.com/blog/2018/07/fixing-bufferbloat-on-your-home-network-with-openbsd-6.2-or-newer.html</url></story><parent_chain></parent_chain><comment><author>y0ssar1an</author><text>Fix it on Linux by enabling BBR TCP congestion control.&lt;p&gt;&lt;pre&gt;&lt;code&gt;  cat &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; &amp;#x2F;etc&amp;#x2F;sysctl.conf
  net.core.default_qdisc=fq
  net.ipv4.tcp_congestion_control=bbr
  EOF
  sudo sysctl -p
&lt;/code&gt;&lt;/pre&gt;
1. You will need a recent kernel.&lt;p&gt;2. net.ipv4.tcp_congestion_control=bbr applies to IPv6 too.&lt;p&gt;3. You must set the queuing discipline to fq or it won&amp;#x27;t work.</text></comment>