大网数据广告活动
服务器运维问答

How does Linux allocate bandwidth between processes?

· 52CE 我爱测

If I don't set up any traffic shaping, how does Linux allocate (outgoing) bandwidth between processes? My specific situation is that I am running 30 identical processes on a cloud VM, each of which is basically sending data over …

问题原文

原帖链接 · Thomas Johnson · CC BY-SA 4.0

If I don't set up any traffic shaping, how does Linux allocate (outgoing) bandwidth between processes?

My specific situation is that I am running 30 identical processes on a cloud VM, each of which is basically sending data over the network (TCP) as fast as possible. Together they seem to hit the total outgoing bandwidth that I expect. However, some of the processes complete much sooner than others, and consume much more bandwidth (up to 3x more). Once the fast processes finish, the remaining processes speed up and use more bandwidth.

How does Linux decide how much bandwidth each process should get?

已采纳解答

原帖链接 · John Mahowald · CC BY-SA 4.0

Like most performance problems, it is complicated. How much bandwidth each task gets is a complex interaction between many things, at different layers of the network stack. Even without shaping. An incomplete list:

  • CPU scheduler for when tasks (and driver interrupt handlers) can get on CPU
  • How fast the tasks get their data, possibly limited by bottlenecks or contention
  • Which queueing discipline is in use, essentially a packet scheduler
  • Driver details, such as the number of hardware TX queues and how they select flows
  • TCP protocol behavior, if one flow happens to hit congestion control it may stay slow while bandwidth is limited
  • All of the above considerations for the remote system(s) receiving the flows
    • If all of your connections aren't going to the same recipient, the other end is possibly of more impact than your end

Many of these are not optimizing for equal bandwidth "fairness", but other criteria. TCP congestion control would rather have a little goodput rather than suffer congestive collapse.

And don't forget, too, you're probably not the only one of the network at any given time - so you also need to factor-in router(s), switch(es), etc between "here" and "there".


Should this be more than a curiosity, a solution to as fast as possible is get more bandwidth.

Or, doing QoS, shaping, or application throttling can set quotas for better overall behavior, whatever better means. But this no longer is as fast as possible, you pick the winners and losers by policy.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-02-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。