3

We have many applications running on the same server machine which is inside a network of servers. We want limit the bandwidth of our applications to specific value. So here are some choices:

   suppose we have three apps: A, B, and C.
   1) Use Linux (kernel 2.6) QoS Utilities to limit the bandwidth of
      these three applications.            
   2) Develop our own application to limit the bandwidth.

Of course the first one is preferred, but we need to know if the qos utilities provided by Linux can fulfill our requirements or not. The first thing to check is if Qos tool like TC provides any means to limit the bandwidth for multiple applications (specifying application names or other)?

Steve Peng
  • 509
  • 1
  • 8
  • 18

2 Answers2

1

You can use the u32 selector as specified in the following example taken from this page. I am showing here only the line of interest.

match u32 00000016 0000ffff at nexthdr+0

This example matches value 0x16 for destination port (third and fourth bytes from beginning of TCP header).

This is just an example to get an idea how you can do it based on destination port.

Khaled
  • 35,688
  • 8
  • 69
  • 98
0

Yup, linux/tc can do what you require, tc allows you to set up filters to match on traffic at a broad level, you can also use iptables to mark packets and match on these marks. If you are trying to match any network traffic for a specific application this gets harder though. I would recommend to run the process as a dedicated user and use the iptables owner match to tag these packets for QoS, tc could then be used on these tags.

s3c
  • 101
  • 2
  • we have three applications, can we limit the bandwidth for these three in a same script? – Steve Peng Aug 15 '13 at 10:56
  • Should be able to with a little tweaking, it gets somewhat harder when these applications each require different amounts of bw but not much. – s3c Aug 15 '13 at 11:00
  • is there any example of doing this available on internet? I want to have a try on my own computer (I am using Ubuntu 3.2.0). – Steve Peng Aug 15 '13 at 11:10
  • M, just came across this, maybe it will help: http://www.tuxradar.com/content/control-your-bandwidth-trickle – s3c Aug 15 '13 at 11:30