net_prio) subsystem provides a way to dynamically set the priority of network traffic per each network interface for applications within various cgroups. A network's priority is a number assigned to network traffic and used internally by the system and network devices. Network priority is used to differentiate packets that are sent, queued, or dropped. The
tccommand may be used to set a network's priority (setting the network priority via the
tccommand is outside the scope of this guide; for more information, refer to the
SO_PRIORITYsocket option. However, applications are often not coded to set the priority value, or the application's traffic is site-specific and does not provide a defined priority.
net_priosubsystem in a cgroup allows the administrator to assign a process to a specific cgroup which defines the priority of outgoing traffic on a given network interface.
net_priosubsystem is not compiled in the kernel like the rest of the subsystems, rather it is a module that has to be loaded before attempting to mount it. To load this module, type as
- a read-only file which contains a unique integer value that the kernel uses as an internal representation of this cgroup.
- contains a map of priorities assigned to traffic originating from processes in this group and leaving the system on various interfaces. This map is represented by a list of pairs in the form
cat /cgroup/net_prio/iscsi/net_prio.ifpriomapeth0 5 eth1 4 eth2 6Contents of the
net_prio.ifpriomapfile can be modified by echoing a string into the file using the above format, for example:
echo "eth0 5" > /cgroup/net_prio/iscsi/net_prio.ifpriomapThe above command forces any traffic originating from processes belonging to the
net_priocgroup, and with traffic outgoing on the
eth0network interface, to have the priority set to the value of
5. The parent cgroup also has a writable
net_prio.ifpriomapfile that can be used to set a system default priority.