Linux Traffic Control and CAKE: Eliminating Bufferbloat
Eliminate latency spikes and packet buffering bottlenecks under high load by deploying CAKE queue discipline via Linux tc.
Netbay Infrastructure Team
Netbay Engineering
On this page
Bufferbloat is the undesirable latency spike that occurs when network equipment or operating system interfaces queue excessive amounts of packet data. Under default Linux network configurations, interfaces employ simple First-In-First-Out (FIFO) queue disciplines with packet buffer lengths of 1000 packets. When a long-running backup or batch download saturates network bandwidth, the FIFO buffer fills completely, adding hundreds of milliseconds of latency to interactive SSH terminals, API requests, and DNS lookups.
Common Applications Kept Enhanced (CAKE) is a modern Linux queue discipline (qdisc) designed to eliminate bufferbloat entirely. CAKE combines advanced active queue management (AQM via CoDel) with fair queuing (FQ), traffic shaping, and automatic DiffServ priority classification.
Configuring CAKE on Network Interfaces
To apply CAKE, use the standard Linux iproute2 traffic control tool tc. Specify the guaranteed egress bandwidth of your uplink to allow CAKE's shaper to manage packet queues inside kernel space rather than on unmanaged ISP switches:
# Replace default pfifo_fast or fq_codel with CAKE on eth0
sudo tc qdisc replace dev eth0 root cake bandwidth 1Gbit diffserv4
# Inspect active qdisc parameters and drop counters
tc -s qdisc show dev eth0Parameters explained:
- bandwidth 1Gbit: Informs the internal shaper of the physical bandwidth bottleneck, ensuring the queue remains under kernel control.
- diffserv4: Activates 4-tier DiffServ priority handling (Bulk, Best Effort, Video, Voice/Interactive), automatically prioritizing ACK packets, SSH, and DNS.
Ingress Traffic Shaping with IFB Devices
While egress shaping is straightforward, ingress traffic shaping requires redirecting inbound packets into an Intermediate Functional Block (IFB) pseudo-device before shaping:
# Load the IFB kernel module
sudo modprobe ifb
sudo ip link set dev ifb0 up
# Redirect ingress traffic from eth0 into ifb0
sudo tc qdisc add dev eth0 handle ffff: ingress
sudo tc filter add dev eth0 parent ffff: protocol all u32 match u32 0 0 action mirred egress redirect dev ifb0
# Apply CAKE to the IFB device to regulate inbound download bursts
sudo tc qdisc add dev ifb0 root cake bandwidth 1GbitInternet Routing and Latency Video
Explore how network packets traverse routing hierarchies and buffering stages across the Internet:
Verifying Latency under Load
Test your server for bufferbloat by running an active ping while executing an intensive multi-stream download test:
# Ping a reference DNS server while downloading test files
ping -c 30 1.1.1.1On a server tuned with CAKE, ping round-trip times remain rock-steady under 5ms even while network bandwidth is 100% saturated.
Enjoy jitter-free network performance on low-latency cloud nodes in Lucknow at netbayhosts.in.
Keep reading
Follow along on a real VPS
Deploy Linux in under 60 seconds
These guides are written against Ubuntu, Debian, and RHEL-family images — the same ones on NetBay.
Deploy an instance