Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are doing QoS (traffic control) for our server application. This server provides file download service for users and we want to give different users different priority and bandwith. Suppose the Linux server gives our applicaton a bandwith of 1M, then we will give the user who has highest priority the most bandwith.

I am going to use the Token and Token Bucket concepts to achieve this, but I don't know how to use Timer and Measurement skills to control the rate of generating Tokens, so I decide to learn from existing sw source code. Can anyone recommend some traffic control software/tools?

I want to know how to use timers to generate tokens by rate (because the tokens are generated at some rate, so we can consider the thread who gets the tokens will send the data to network interface at the same rate with that tokens being generated).

share|improve this question

closed as off-topic by Nathan C, Ward, Shane Madden, freiheit, Jenny D Jul 7 '13 at 8:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they tend to become obsolete quickly. Instead, describe your situation and the specific problem you're trying to solve." – Nathan C, Ward, Shane Madden, freiheit, Jenny D
If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 2 down vote accepted

MasterShapper could be what you are looking for. One can read

It (MasterShapper) targets to let users learn and use the traffic shaping mechanism. This should be possible for everyone who has no deeper knowledge of Linux and the difficult syntax of the tc commands from the iproute2 package.

and is OpenSource, so you can as you said

learn from existing sw source code

share|improve this answer
@slm Thanks. Is now right? – gsi-frank Jul 7 '13 at 2:41
Looks good - thanks. – slm Jul 7 '13 at 2:42
is it written by PHP? Am I wrong? I can't find any source code written in Java, c or C++ from this repository – Steve Peng Jul 7 '13 at 5:47
Is written in PHP, here you can see code that build the tc commands. – gsi-frank Jul 7 '13 at 5:54
So learn from existing sw source code is not what you want, even you found a software in a language that you know, reading source code will be too difficult to learn about tc. I recommend you read related doc, this one could be a good start and then code whatever app you want. – gsi-frank Jul 7 '13 at 14:52

Typically the application doesn't control the bandwidth allocated to specific sockets, nor does it know how much the kernel is sending its traffic versus that of other applications.

The utility tc (part of iproute2), combined with iptables setting marks on packets and connections, can be used to implement an arbitrarily complex hierarchical token bucket system (with its htb qdisc), and you should consider looking into this.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.