Pfifo_fast explained

Pfifo_fast is the default qdisc in Linux. It is a classful queing discipline that contains 3 numbers of classes of differing priority that are dequeued in numerical descending order of priority. That is how it is described in the man page. Sounds complicated? Actually it is really simple.

Have you ever watched how ferries are loaded? There are different queues for motorcycles, cars and trucks. Motorcycles are loaded first, then cars and last the trucks. In that way we can avoid unnecessary congestion on the other shore.

It is perfectly the same with our network traffic. Motorcycles is something like ssh packets. We want them to be as fast as they can be and not to be delayed by file transfers. Cars are our “normal traffic” like http. We do not want those packets delayed by file transfers as well. And last but not least there is our heavyweight traffic like file transfers (trucks).

Packets are prioritized by the TOS bits and mapped to one of the 3 queues with a priomap. That is like the steward who directs the vehicle driver to his queue.

%3 cluster_band0 band0 cluster_band1 band1 cluster_band2 band2 enqueue priomap enqueue->a0 enqueue->a1 a2 ftp enqueue->a2 d0 ssh e0 ssh c1 http d1 http e1 http b2 ftp c2 ftp d2 ftp e2 ftp

Dequeueing (loading the ferry) then is ordered by priority. First we dequeue prio0 traffic (motorcycles/ssh).

%3 cluster_band0 band0 cluster_band1 band1 cluster_band2 band2 cluster_tc traffic control cluster_network network t0 c1 http d1 http e1 http t1 a2 ftp b2 ftp c2 ftp d2 ftp e2 ftp t2 nd0 ssh ne0 ssh

Then we dequeue prio1 traffic (cars/http).

%3 cluster_band0 band0 cluster_band1 band1 cluster_band2 band2 cluster_tc traffic control cluster_network network t0 t1 a2 ftp b2 ftp c2 ftp d2 ftp e2 ftp t2 nc1 http nd1 http ne1 http nd0 ssh ne0 ssh

Finally we dequeue prio2 traffic (trucks/ftp).

%3 cluster_band0 band0 cluster_band1 band1 cluster_band2 band2 cluster_tc traffic control cluster_network network t0 t1 t2 na2 ftp nb2 ftp nc2 ftp nd2 ftp ne2 ftp nc1 http nd1 http ne1 http nd0 ssh ne0 ssh

That’s it. Actually not complicated at all. Isn’t it?

Contact