Optimizing interface traffic

Optimizing traffic on interface can be very complicated issue. Linux kernel has lots of features, qos and queueing discipline algorithms like htb, sfq, hfsc. You can even mix these queues with proper bandwidth borrowing strategies.

In the old days a script named wondershaper was very popular. I see it is still used heavily but it doesn’t fit todays network speeds and requirements. At the time of wondershaper was developed, MTU size on DSL networks different and encapsulation aware techniques that compensated for ATM and PPPoE didn’t exist. It produce optimal result for when you have 1 Mbps download, 256 Kbps of upload link with average webpage size under 100 Kb. But today, wondershaper works very bad. Unfortunately most of the distributions shipped with wondershaper script and it still used widely.

Today we have new alternatives which scales well. There are important changes in kernel too, so I suggest to use kernel version 3.12 or higher.

One of the models which is very popular now is Fair Queue CoDel Discipline. It is a modern controlled queue delay solution which attacks bufferbloat problem. You can look at the theory here which was developed by famous Van Jacobson and Kathleen Nichols: http://queue.acm.org/detail.cfm?id=2209336

And the good news is, unlike other queueing disciplines, CoDel implementation so easy to use. There are only 4 parameters which are also has good default values, so you can also skip them if you don’t know what exactly doing.

To activate CoDel discipline in a new Linux system (on interface ppp0 here), you have to just use following command:

tc qdisc add dev ppp0 root codel

That’s all.

CoDel works very-well on links especially 5 Mbps or more (up to Gigabits).

You can look at the other parameters in codel manpage.