Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
4.2. Prioritizing Network Traffic
When running multiple network-related services on a single server system, it is important to define network priorities among these services. Defining the priorities ensures that packets originating from certain services have a higher priority than packets originating from other services. For example, such priorities are useful when a server system simultaneously functions as an NFS and Samba server. The NFS traffic has to be of high priority as users expect high throughput. The Samba traffic can be deprioritized to allow better performance of the NFS server.
The
net_prio controller can be used to set network priorities for processes in cgroups. These priorities are then translated into Type of Service (ToS) field bits and embedded into every packet. Follow the steps in Procedure 4.2, “Setting Network Priorities for File Sharing Services” to configure prioritization of two file sharing services (NFS and Samba).
Procedure 4.2. Setting Network Priorities for File Sharing Services
- Attach the
net_priosubsystem to the/cgroup/net_priocgroup:mkdir sys/fs/cgroup/net_prio mount -t cgroup -o net_prio none sys/fs/cgroup/net_prio
~]# mkdir sys/fs/cgroup/net_prio ~]# mount -t cgroup -o net_prio none sys/fs/cgroup/net_prioCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create two cgroups, one for each service:
mkdir sys/fs/cgroup/net_prio/nfs_high mkdir sys/fs/cgroup/net_prio/samba_low
~]# mkdir sys/fs/cgroup/net_prio/nfs_high ~]# mkdir sys/fs/cgroup/net_prio/samba_lowCopy to Clipboard Copied! Toggle word wrap Toggle overflow - To automatically move the
nfsservices to thenfs_highcgroup, add the following line to the/etc/sysconfig/nfsfile:CGROUP_DAEMON="net_prio:nfs_high"
CGROUP_DAEMON="net_prio:nfs_high"Copy to Clipboard Copied! Toggle word wrap Toggle overflow This configuration ensures thatnfsservice processes are moved to thenfs_highcgroup when thenfsservice is started or restarted. - The
smbdservice does not have a configuration file in the/etc/sysconfigdirectory. To automatically move thesmbdservice to thesamba_lowcgroup, add the following line to the/etc/cgrules.conffile:*:smbd net_prio samba_low
*:smbd net_prio samba_lowCopy to Clipboard Copied! Toggle word wrap Toggle overflow Note that this rule moves everysmbdservice, not only/usr/sbin/smbd, into thesamba_lowcgroup.You can define rules for thenmbdandwinbinddservices to be moved to thesamba_lowcgroup in a similar way. - Start the
cgredservice to load the configuration from the previous step:systemctl start cgred Starting CGroup Rules Engine Daemon: [ OK ]
~]# systemctl start cgred Starting CGroup Rules Engine Daemon: [ OK ]Copy to Clipboard Copied! Toggle word wrap Toggle overflow - For the purposes of this example, let us assume both services use the
eth1network interface. Define network priorities for each cgroup, where1denotes low priority and10denotes high priority:echo "eth1 1" > /sys/fs/cgroup/net_prio/samba_low/net_prio.ifpriomap echo "eth1 10" > /sys/fs/cgroup/net_prio/nfs_high/net_prio.ifpriomap
~]# echo "eth1 1" > /sys/fs/cgroup/net_prio/samba_low/net_prio.ifpriomap ~]# echo "eth1 10" > /sys/fs/cgroup/net_prio/nfs_high/net_prio.ifpriomapCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Start the
nfsandsmbservices and check whether their processes have been moved into the correct cgroups:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Network traffic originating from NFS now has higher priority than traffic originating from Samba.
Similar to Procedure 4.2, “Setting Network Priorities for File Sharing Services”, the
net_prio subsystem can be used to set network priorities for client applications, for example, Firefox.