---
title: "fq vs CAKE: Why BBR Pacing Collapsed a 200 Mbit/s Uplink"
url: https://www.induqora.com/blog/fq-vs-cake-bbr-pacing-nginx-listen-backlog
publication: Induqora
type: Insight
category: Industrial Networking
author: Edward (Editor, Induqora)
author_url: https://www.induqora.com/author/edward
published: 2026-11-30
updated: 2026-11-30
reading_minutes: 9
tags: ["IIoT", "Industrial Ethernet", "Control system architecture", "Edge computing"]
---

# fq vs CAKE: Why BBR Pacing Collapsed a 200 Mbit/s Uplink

> A field log from two edge relays in front of a plant data stack: an uplink that looked flawless under ping while discarding a third of its bytes, three queue disciplines that collapsed BBR pacing to about 1 Mbit/s, nginx listen queues still bound at 4096 long after somaxconn was raised, and the small set of sysctls that measurably helped.

## Key takeaways

- A green ping chart is not evidence of a healthy path: zero ICMP loss coexisted with 28% loss on a 250 Mbit/s UDP stream to the same peer.
- Sweep UDP bitrate first to find the real path ceiling; TCP hides policer loss behind retransmission and congestion-window collapse.
- Replacing the fq root discipline with cake or htb on a virtio NIC running BBR reduced a 200 Mbit/s uplink to about 1 Mbit/s, with the limiter itself reporting zero drops.
- A listening socket keeps the accept queue limit that was in force when it was created: nginx reload does not rebind, so Send-Q can stay at 4096 long after somaxconn reaches 65535.
- Only a handful of sysctls produced measurable change; tcp_max_tw_buckets, tcp_retries2, tcp_syn_retries and tcp_notsent_lowat mattered, while rmem_max and default_qdisc did not.

Operators describe a slow link with words that do not survive measurement: "it feels sticky", "SSH hangs for a second", "the dashboard freezes". Our case was an edge relay pair sitting between a factory network and a remote-support gateway. One relay ran on a 1 vCPU / 1 GB Guangzhou VM behind carrier NAT; the other terminated several TCP relays on a Hong Kong BGP host. Interactive sessions were fine most of the day, then a historian upload or a remote-support file transfer would start and every session on the box would stall for a few seconds.

The link was not obviously broken. Round-trip time to the gateway was 3.8 ms with 0.02 ms jitter, path MTU 1500 passed end to end, and ICMP showed zero loss over 50 probes. Everything a monitoring dashboard shows was green.

That is the point where most tuning sessions go wrong: a green dashboard invites sysctl guessing. The actual faults were three, and only one of them was a kernel parameter.

## Why "ping is fine" proves almost nothing

A 64-byte ICMP echo does not fill a queue, does not trigger a traffic policer for long enough to drop anything, and is frequently handled on a different priority path than bulk TCP. It measures reachability and propagation delay, nothing else. In our case it was actively misleading:

- ICMP loss was 0%, while the same path dropped 28% of a 250 Mbit/s UDP stream.
- `ss` showed listening sockets whose accept queue was one sixteenth of the configured limit.
- TCP retransmitted thousands of segments per ten-second transfer while the NIC reported zero drops.

Each of those is invisible to a ping chart and each of them has a different owner: carrier, kernel, application.

## Measure the path before changing a single sysctl

The order matters. First establish the path ceiling with UDP, because TCP hides loss behind retransmission and congestion-window collapse. Then measure TCP to see what the stack actually achieves. Only then look at counters.

```bash
# 1. Path quality: latency, jitter, MTU
ping -c 50 -i 0.2 203.0.113.10
ping -c 2 -M do -s 1472 203.0.113.10

# 2. Ceiling sweep: UDP shows loss the moment a policer engages
for rate in 100 150 200 250 350; do
  iperf3 -c 203.0.113.10 -p 13845 -u -b ${rate}M -t 10
done

# 3. What TCP really delivers, one stream and reverse
iperf3 -c 203.0.113.10 -p 13845 -t 10
iperf3 -c 203.0.113.10 -p 13845 -t 10 -R

# 4. Counters: loss, retransmission, listening queue depth
ss -ltn
tc -s qdisc show dev ens5
nstat -az | grep -Ei 'retrans|timewait|listen|ofo|dsack'
```

The UDP sweep is the single most useful command in this whole article. TCP at 209 Mbit/s looked acceptable; the UDP sweep showed the path was already shedding 28% of the offered load at 250 Mbit/s.

## What the counters actually showed

Every datapoint below is from the same pair of hosts, roughly fifteen minutes apart, with no other traffic on the relay.

![Engineering diagram comparing uplink throughput for fq, cake and htb queue disciplines next to listening socket backlog before and after an nginx restart](/media/2026/11/diagram-fq-vs-cake-bbr-pacing-nginx-listen-backlog.png "Figure 1: The rate-bearing qdiscs never reached their configured limit, and the accept queue only changed after the listening socket was recreated.")

| Test | Offered | Delivered | Loss | Interpretation |
|---|---|---|---|---|
| ICMP, 50 probes | 64 B | 64 B | 0% | Path is reachable, nothing more |
| Path MTU probe, DF bit | 1472 B | 1472 B | 0% | No fragmentation black hole |
| UDP 10 s | 100 Mbit/s | 100 Mbit/s | 0% | Path is clean below the ceiling |
| UDP 10 s | 200 Mbit/s | 199 Mbit/s | under 1% | Still clean |
| UDP 10 s | 250 Mbit/s | 179 Mbit/s | 28% | A policer is active |
| UDP 10 s | 350 Mbit/s | 174 Mbit/s | 50% | Hard ceiling near 200 Mbit/s |
| TCP one stream | unthrottled | 209 Mbit/s | 14,000 retransmits in 8 s | Stack fighting the ceiling |
| TCP reverse | unthrottled | 407 Mbit/s | thousands of retransmits | Asymmetric policing |

Two counter groups decided the diagnosis. First, the local queue was innocent: `tc -s qdisc` showed a few thousand drops accumulated across 149 GB, and the NIC drop counters were zero. Second, the loss was real and not a reordering artefact:

- `TCPOFOQueue` stayed at 0 and `DSACKRecv` at 2, so the receiver was not merely seeing out-of-order delivery.
- `TCPLostRetransmit` reached 4,721, meaning even the retransmissions were being discarded.
- The peer's own retransmit counter was about twelve times lower than ours, which places the loss on our egress, downstream of the NIC.

That combination — clean MTU, zero local drops, real loss on retransmissions, and a stable 3.8 ms RTT — is the signature of a rate policer in the provider path, not of congestion, bufferbloat, or a misconfigured interface.

## The trap: every rate-bearing qdisc replaces the pacing layer

The obvious next move is traffic shaping: queue the excess in our own qdisc instead of letting the carrier discard it. That is standard advice and it failed catastrophically here.

The relay ran BBR on a virtio NIC with the root discipline set to `fq`. We replaced it with three different rate-bearing configurations, each time measuring with the same peer and the same ten-second iperf3 run:

| Root discipline | Uplink | Downlink | Limiter counters | Verdict |
|---|---|---|---|---|
| `fq` (baseline) | 209 Mbit/s, later 122–239 Mbit/s | 407 Mbit/s | n/a | Works |
| `cake 185mbit diffserv4` | 1.05 Mbit/s | 24.9 Mbit/s | `dropped` near 0 | Collapsed |
| `cake 185mbit` (plain) | 1.05 Mbit/s | 124 Mbit/s | `overlimits` 1,498, `dropped` 0 | Collapsed |
| `htb 185mbit` + `fq_codel` leaf | 1.22 Mbit/s | 1.05 Mbit/s | `overlimits` 0, `dropped` 0 | Collapsed |

The instructive row is the last one. HTB reported `overlimits 0`, meaning the shaper never actually had to throttle anything — the connection was already at 1.22 Mbit/s, far below its 185 Mbit/s ceiling. The collapse therefore was not the limiter doing its job correctly, nor a misconfigured burst size, nor a queue too small for BBR's bandwidth-delay product.

Two mechanisms explain what we saw, and both are worth checking before you copy a shaping recipe from a blog post:

1. **Pacing dependency.** BBR paces packets through the qdisc's pacing hooks. `fq` is where that pacing is realised per flow. A classful qdisc without equivalent pacing support turns a smooth 200 Mbit/s pacing schedule into bursts that the carrier policer discards, and TCP collapses.
2. **Lost multi-queue fan-out.** On a multi-queue virtio device the stack ships with an `mq` root and one child qdisc per TX queue. A single-root `cake` or `htb` funnels every flow through one lock and one queue pair, which on a small 1 vCPU instance is enough to serialise the sender.

We rolled back within the same hour. A tenth of the throughput is worse than an impolite carrier policer, and no sysctl can repair a bad queue topology.

There is also a persistence trap that outlives the experiment. `net.core.default_qdisc` only applies to newly created devices; it does not rewrite a qdisc that already exists. Worse, a forgotten `post-up` line in `/etc/network/interfaces` can silently restore `fq_codel` on the next reboot or interface bounce, quietly removing the pacing layer months after you fixed it. Verify with `tc qdisc show`, not with `sysctl net.core.default_qdisc`.

## Stale listen backlogs: the 4096 nobody notices

The second fault had nothing to do with bandwidth. Both relays accepted connections slowly during reconnect storms, and the reason was a listening socket that was older than the configuration meant to improve it.

`net.core.somaxconn` was already 65535 on both hosts. The listening sockets were not:

```text
State  Recv-Q  Send-Q  Local Address:Port
LISTEN 0       4096    0.0.0.0:10801
LISTEN 0       511     0.0.0.0:80
```

`Send-Q` on a listening socket is the actual accept queue limit, frozen at the value in force when the socket was created. nginx had been reloaded several times since the sysctl was raised, but `reload` keeps the existing listen sockets; it only re-binds when the listen options themselves change. The master process was 43 days old, so every relay port still advertised 4096, and `ListenDrops` had accumulated 1,625 events.

Two config layers matter here:

| Layer | Setting | Applies when |
|---|---|---|
| Kernel | `net.core.somaxconn = 65535` | Caps new listening sockets only |
| nginx stream | `listen 10801 backlog=65535;` | On socket creation or rebind |
| nginx http | `listen 80 backlog=65535;` | Defaults to 511 when unset |

The fix is not `reload`. It is `systemctl restart nginx`, which recreates the listening sockets and lets them inherit `somaxconn`. After the restart the same `ss -ltn` output read 65535 for every relay port and `ListenDrops` stopped increasing. For the HTTP listeners, adding `backlog=65535` to the `listen` directive does rebind on reload, because the listen options changed.

This is the cheapest performance fix in the entire article and it is invisible unless you look at `Send-Q` instead of `somaxconn`.

## Which sysctls actually mattered

With the path characterised and the queue topology left alone, the kernel tuning shrank to a short list. Everything below was verified after `sysctl --system`.

| Parameter | Before | After | Effect observed |
|---|---|---|---|
| `net.ipv4.tcp_max_tw_buckets` | 30000 | 65536 | Stops the kernel from killing TIME_WAIT entries during reconnect storms; overflow had been recorded 11,706 times |
| `net.ipv4.tcp_retries2` | 15 | 10 | Dead peers fail in about five minutes instead of fifteen |
| `net.ipv4.tcp_syn_retries` | 6 | 4 | Unreachable backends fail over in about 15 s instead of 127 s |
| `net.ipv4.tcp_notsent_lowat` | unset | 131072 | Less unsent data buffered per connection, lower tail latency on multiplexed tunnels |
| `vm.swappiness` | 60 | 10 | No swap on these hosts; prevents future swap thrash |

Three popular changes did nothing measurable and are worth naming, because they are repeated endlessly in tuning guides:

- Raising `rmem_max` and `wmem_max` does not help when `tcp_rmem` and `tcp_wmem` already cap autotuning. The socket never grows past those limits.
- `net.core.default_qdisc` does not change an existing device. Only `tc qdisc replace` does, and only until the next boot hook.
- `somaxconn` alone does nothing for a process that has not recreated its listening socket.

And one thing that looked like a bug but was not: the interface reported `mq` with an `fq_codel` child while `default_qdisc` said `fq`. That is expected on multi-queue NICs, where `mq` is the root and the per-queue child is inherited from `default_qdisc` at creation time.

## A verification sequence worth keeping

Any change to queues, listen backlogs, or kernel network parameters should be followed by the same five checks. They take fifteen seconds and catch the mistakes above.

```bash
sysctl --system
nginx -t && nginx -s reload
ss -ltn | awk 'NR==1 || $4 ~ /:80$/ || $4 ~ /:1080[0-9]$/'
tc -s qdisc show dev ens5
nstat -az | grep -E 'ListenDrops|TCPTimeWaitOverflow|TCPLostRetransmit'
```

Read them in this order: does the kernel agree with the file, did nginx accept the config, did the listening sockets actually change, is the root discipline still the one you intended, and are the drop counters still moving. A change that leaves a counter climbing was not a fix.

## What we changed, and what we did not

Applied:

1. Replaced a `post-up tc qdisc replace ... fq_codel` hook that would have silently removed the pacing layer on the next reboot.
2. Restarted nginx so stale listen sockets inherited `somaxconn`, and added `backlog=65535` to the HTTP listeners.
3. Raised `tcp_max_tw_buckets` to 65536 on the hosts that had recorded TIME_WAIT overflow.
4. Shortened `tcp_retries2` and `tcp_syn_retries` so failed backends stop holding sessions open.

Deliberately not applied:

- No qdisc shaping on the virtio hosts. The measured collapse outweighs the theoretical benefit of local queuing, and the real ceiling belongs to the provider.
- No nginx `limit_rate`. Both sites served API and reverse-proxy traffic only; there was no large-file location to throttle, so a global limit would have slowed normal requests.
- No `rsync --bwlimit` still, because rsync is not installed. When bulk transfers are added, that is where they should be capped, at the application layer, not by breaking the qdisc under BBR.

The remaining asymmetry — a hard policer near 200 Mbit/s on egress — cannot be fixed from inside the guest. It can only be measured, reported to the provider, and routed around. For factory-side remote support over such a link, that means keeping interactive traffic and bulk historian uploads on separate paths where possible, and treating "fits in a 150 Mbit/s budget" as the design assumption rather than the headline bandwidth.

If you maintain industrial edge nodes, the transferable lesson is that kernel networking counters and queue depth deserve the same attention as cable diagnostics. A CRC counter on a switch port tells you the physical layer is unhappy; a `ListenDrops` counter and a `Send-Q` of 4096 tell you the application layer is.

## Frequently asked questions

### Why did throughput collapse to about 1 Mbit/s after adding traffic shaping with CAKE or HTB?

In our measurements the limiter was never the constraint: HTB reported zero overlimits while the transfer was already at 1.22 Mbit/s. BBR relies on fq for per-flow pacing, so replacing the root discipline with a classful qdisc without equivalent pacing support turned a smooth pacing schedule into bursts that the upstream policer discarded. On a multi-queue virtio device, a single-root qdisc also removes the per-TX-queue fan-out. We rolled back to fq and throughput returned immediately.

### Is net.core.default_qdisc enough to guarantee fq stays in place after a reboot?

No. It only applies to newly created devices, and it does not rewrite an existing qdisc. A leftover post-up rule in the network configuration can silently install fq_codel on boot, and a container or cloud init path may do the same. Verify the live state with tc qdisc show rather than trusting the sysctl value.

### Why is the nginx listen backlog still 4096 when somaxconn is 65535?

A listening socket keeps the backlog value from the moment it was created. nginx reload keeps existing listen sockets, so raising somaxconn afterwards has no effect on them. Check Send-Q in ss -ltn, add backlog=65535 to the listen directives, and restart the service rather than reloading it.

### Which sysctls are worth changing on a small edge relay?

Focus on ones with an observable effect: tcp_max_tw_buckets to stop TIME_WAIT entries being culled during reconnect storms, tcp_retries2 and tcp_syn_retries to fail over from dead backends quickly, and tcp_notsent_lowat to bound unsent data on multiplexed tunnels. Buffer maximums such as rmem_max and wmem_max do not raise throughput when tcp_rmem and tcp_wmem autotuning caps are already the binding limit.

## Sources and further reading

- [tc-cake(8) queue discipline manual (Linux man-pages project)](https://man7.org/linux/man-pages/man8/tc-cake.8.html)
- [tc-fq(8) and tc-htb(8) queue discipline manuals (Linux man-pages project)](https://man7.org/linux/man-pages/man8/tc-fq.8.html)
- [nginx listen directive, backlog parameter (F5, Inc.)](https://nginx.org/en/docs/http/ngx_http_core_module.html)
- [net.core.somaxconn and socket listen backlog (Linux kernel documentation)](https://docs.kernel.org/networking/ip-sysctl.html)
- [BBR congestion control, IETF draft cardwell-ccbbr (IETF)](https://datatracker.ietf.org/doc/draft-cardwell-iccrg-bbr-congestion-control/)
- [iperf3 UDP and TCP measurement documentation (ESnet)](https://software.es.net/iperf/)
