mtv*_*vec 24 networking linux bandwidth priority
Linux 中有没有办法为特定应用程序提供更多/更少的网络带宽优先级?类似于niceCPU 优先级的方法。
背景:我目前使用的带宽非常低(3G 加密狗)。当我使用 执行相当大的升级时aptitude,几乎无法浏览网络,因为升级下载占用了我的 Internet 连接。
所以我想做的是以某种方式降低aptitude进程(及其所有子进程)的网络带宽优先级,以便在另一个进程正在使用它时不会使用太多带宽。
小智 9
您可以使用 force_bind 为应用程序的所有套接字设置优先级,然后使用 Linux QoS(tc 命令),您可以将应用程序分配到优先级段。检查 README 文件以获取示例。
免责声明:我是作者。
例子:
14: Force priority (between 0 and 6 for non-root users). You can
use 'tc' command from iproute to set-up 'prio' qdisc and to
assign prio to queues:
# 0. setup
export FORCE_NET_VERBOSE=1
export LD_PRELOAD=${LD_PRELOAD}:/usr/lib/force_bind.so
# 1. Make sure you have a 'prio' qdisc attached to eth0, for example:
tc qdisc add ev eth0 root handle 1: prio
# 2. Assign applications to classed (bands):
export FORCE_NET_PRIO=6 # interactive, band 0
your_voip_program_here
export FORCE_NET_PRIO=0 # best effort, band 1
your_mail_program_here
export FORCE_NET_PRIO=2 # bulk, band 2
your_remote_backup_program_here
# 3. Run tc statistics so you can see the classification:
tc -s class show dev eth0
Run Code Online (Sandbox Code Playgroud)
当然,您可以使用 htb 或任何其他 qdisc。
| 归档时间: |
|
| 查看次数: |
10635 次 |
| 最近记录: |