What is CAKE?
Common Applications Kept Enhanced
CAKE (Common Applications Kept Enhanced) is a Linux queueing discipline that shapes a link to a set rate and keeps every queue on it short, so one big transfer can't make the whole connection slow for everyone else.
It exists to fix bufferbloat. A broadband modem usually has a large, simple buffer in front of a slow line, and a single upload or download fills it, so every other packet, a call, a game, a keystroke, waits behind seconds of queued data. CAKE runs on the router and sends slightly slower than the line, so the queue forms in the router instead, where CAKE manages it with three tools in one: a shaper, fair queueing (each flow, and optionally each host, gets its share), and AQM, which drops or marks a few packets from bulk flows as soon as their queue grows. It also understands DiffServ markings (three or more priority "tins") and the extra overhead of common link types such as cable, DSL and PPPoE.
In practice it's one command, tc qdisc replace dev <wan> root cake bandwidth <rate>, with the rate set to 85–95% of the line's real speed. Downloads need an IFB device, because Linux only queues outgoing traffic, and the ingress keyword. For fairness between the PCs in an office, use dual-srchost on uploads and dual-dsthost on downloads, and add nat when the shaped interface does NAT. CAKE is in the mainline Linux kernel and OpenWrt; some container kernels leave it out. See also QoS. The Traffic shaping with CAKE on Debian lesson measures bufferbloat and fixes it.
Lessons that use CAKE
- Traffic shaping with CAKE on DebianTeaches this term · Intermediate · 40 min
Measure bufferbloat on an office line, then fix it on a Debian 13 router with CAKE: shaping uploads on the WAN and downloads through an IFB, fair shares between hosts, making it permanent with systemd-networkd, and tuning it for your line.