Documentation/cgroups/net_prio

Chinese translated version of Documentation/cgroups/net_prio

If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.

Chinese maintainer:Hu Feijun <935620544@qq.com>
---------------------------------------------------------------------
Documentation/cgroups/net_prio 的中文翻译

如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。

中文版维护者: 胡飞军  Hu Feijun <935620544@qq.com>
中文版翻译者: 胡飞军  Hu Feijun <935620544@qq.com>
中文版校译者: 胡飞军  Hu Feijun <935620544@qq.com>

以下为正文  
---------------------------------------------------------------------

Network priority cgroup
-------------------------

网络优先权控制族群
-------------------------

The Network priority cgroup provides an interface to allow an administrator to
dynamically set the priority of network traffic generated by various
applications

网络优先权控制族群为管理员提供了一个可以动态地设置网络流量优先权的接口,
这个网络流量是由各种应用程序所产生的。

Nominally, an application would set the priority of its traffic via the
SO_PRIORITY socket option.  This however, is not always possible because:

1) The application may not have been coded to set this value
2) The priority of application traffic is often a site-specific administrative
   decision rather than an application defined one.
  
从名义上来说,每个应用程序将会通过套接字选项SO_PRIORITY来这只自己的网络优先权。
但这个往往是不可行的,因为:

1)这个应用程序并没有用来设置这个值的代码。
2)应用程序的优先权通常是特定于站点管理的决定,而不是应用程序自身定义的。

This cgroup allows an administrator to assign a process to a group which defines
the priority of egress traffic on a given interface. Network priority groups can
be created by first mounting the cgroup filesystem.

# mount -t cgroup -onet_prio none /sys/fs/cgroup/net_prio

With the above step, the initial group acting as the parent accounting group
becomes visible at '/sys/fs/cgroup/net_prio'.  This group includes all tasks in
the system. '/sys/fs/cgroup/net_prio/tasks' lists the tasks in this cgroup.


这个控制族群允许管理员对一个族群制定一个进程,这个进程定义了给定接口上出口
流量的优先权。网络优先级组是由第一个挂载cgroup的文件系统产生的。

# mount -t cgroup -onet_prio none /sys/fs/cgroup/net_prio

通过以上步骤,作为父计数组的初始族群在'/sys/fs/cgroup/net_prio'上可见。这个组包含了
系统上所有的任务。'/sys/fs/cgroup/net_prio/tasks'列出了这个cgroup里的所有任务。

Each net_prio cgroup contains two files that are subsystem specific

每个net_prio cgroup包含了两个子系统特定的文件。

net_prio.prioidx
This file is read-only, and is simply informative.  It contains a unique integer
value that the kernel uses as an internal representation of this cgroup.

net_prio.prioidx
这是个只读文件,信息简单,包含了一个独特的整数,在kernel里作为这个cgroup的
内部代表。

net_prio.ifpriomap
This file contains a map of the priorities assigned to traffic originating from
processes in this group and egressing the system on various interfaces. It
contains a list of tuples in the form <ifname priority>.  Contents of this file
can be modified by echoing a string into the file using the same tuple format.
for example:

echo "eth0 5" > /sys/fs/cgroups/net_prio/iscsi/net_prio.ifpriomap

This command would force any traffic originating from processes belonging to the
iscsi net_prio cgroup and egressing on interface eth0 to have the priority of
said traffic set to the value 5. The parent accounting group also has a
writeable 'net_prio.ifpriomap' file that can be used to set a system default
priority.

net_prio.ifpriomap
这个文件包含了流量优先权的映射,这些流量是由这个组里的进程通过不同的接口进出
系统所产生的。文件包一个元祖列表,以<ifname priority>的形式存在。将相同的元祖格
式以字符串的形式写入文件可以改变文件的内容。
例如:

echo "eth0 5" > /sys/fs/cgroups/net_prio/iscsi/net_prio.ifpriomap

任何属于iscsi net_prio cgroup和来自接口eth0的进程所产生的流量,将在这个命令的迫
使下将优先权设置为5.父计数组也有一个可写的 'net_prio.ifpriomap'文件,可以用来设置
系统默认的优先权。

Priorities are set immediately prior to queueing a frame to the device
queueing discipline (qdisc) so priorities will be assigned prior to the hardware
queue selection being made.

优先权设置先于帧在设备队列中的排队,因此优先权设定早于硬件队列的选择。


One usage for the net_prio cgroup is with mqprio qdisc allowing application
traffic to be steered to hardware/driver based traffic classes. These mappings
can then be managed by administrators or other networking protocols such as
DCBX.

net_prio cgroup的一项用处是在有mqprio的情况下,qdisc允许应用程序流量流向以
硬件/驱动器为基础的流量级。这些映射可以被管理云或其他网络协议(如DCBX)管理。

A new net_prio cgroup inherits the parent's configuration.
一个新的net_prio cgroup 继承父net_prio cgroup 的配置。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值