nice bandwidth usage

  • Follow


Greetings.

There exists the "nice" command which schedules processes with lower CPU 
priority, and the "ionice" command to give processes lower I/O priority.  
These prevent processes from hogging the CPU or disk.

Is there a similar command for giving a process lower network priority?  I 
don't mean just throttling the bandwidth to a fixed level, but actually 
letting a process use as much bandwidth as it wants provided that no other 
higher-priority process is trying to upload or download something.  This 
sort of thing would be very useful to use in conjunction with software 
updaters, BitTorrent clients, large rsync jobs, etc. that one would want to 
run in the background and not disrupt one's web browsing experience.

Regards,
Tristan

-- 
   _
  _V.-o         Tristan Miller          ><  Space is limited
 / |`-'  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-  <>  In a haiku, so it's hard
(7_\\    http://www.nothingisreal.com/  ><  To finish what you
0
Reply psychonaut (528) 2/1/2010 12:05:43 PM

On Mon, 01 Feb 2010 12:05:43 +0000, Tristan Miller wrote:

> This sort of thing would be very useful to use in conjunction with
> software updaters, BitTorrent clients, large rsync jobs, etc.

There are two approaches to this problem.

You can use eg a BitTorrent client which allows you to adjust the 
bandwidth usage eg Deluge or Transmission, the latter even having the 
feature of a button to click to go to a Turtle mode for when you
just need most of the bandwidth for immediate use by something else,
and eg for rsync use the --bwlimit=KBPS command line flag.

The other approach is to use QOS tuning on your router or iptables
implementation. See the iptables manual page for the CLASSIFY
directive.

This is rather more complicated and laborious to implement but is
the way to "enforce" limits on recalcitrant users whether or not
they implement the "voluntary" approach via the program settings
mentioned above.
0
Reply J 2/1/2010 2:15:01 PM


Greetings.

In article <1265033701_57@vo.lu>, J G Miller wrote:

> On Mon, 01 Feb 2010 12:05:43 +0000, Tristan Miller wrote:
> 
>> This sort of thing would be very useful to use in conjunction with
>> software updaters, BitTorrent clients, large rsync jobs, etc.
> 
> There are two approaches to this problem.
> 
> You can use eg a BitTorrent client which allows you to adjust the
> bandwidth usage eg Deluge or Transmission, the latter even having the
> feature of a button to click to go to a Turtle mode for when you
> just need most of the bandwidth for immediate use by something else,
> and eg for rsync use the --bwlimit=KBPS command line flag.
> 
> The other approach is to use QOS tuning on your router or iptables
> implementation. See the iptables manual page for the CLASSIFY
> directive.
> 
> This is rather more complicated and laborious to implement but is
> the way to "enforce" limits on recalcitrant users whether or not
> they implement the "voluntary" approach via the program settings
> mentioned above.

Doesn't iptables work on a per-port or per-protocol basis?  If so, that 
approach doesn't really solve my problem, since there will be some HTTP 
connections (like YaST's software updater) I want "niced" and others (like 
my web browser) which I don't.  How is iptables going to know which is 
which?

Also, your solution for rsync isn't applicable.  I don't want to fix the 
bandwidth limit; I want it to dynamically adjust itself, taking all the 
bandwidth when possible and cutting back when higher-priority processes are 
using it.

Regards,
Tristan

-- 
   _
  _V.-o         Tristan Miller          ><  Space is limited
 / |`-'  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-  <>  In a haiku, so it's hard
(7_\\    http://www.nothingisreal.com/  ><  To finish what you
0
Reply Tristan 2/1/2010 3:03:56 PM

On 2010-02-01, Tristan Miller <psychonaut@nothingisreal.com> wrote:
> Greetings.
>
> There exists the "nice" command which schedules processes with lower CPU 
> priority, and the "ionice" command to give processes lower I/O priority.  
> These prevent processes from hogging the CPU or disk.
>
> Is there a similar command for giving a process lower network
> priority?  I don't mean just throttling the bandwidth to a fixed
> level, but actually letting a process use as much bandwidth as it
> wants provided that no other higher-priority process is trying to
> upload or download something.  This sort of thing would be very useful
> to use in conjunction with software updaters, BitTorrent clients,
> large rsync jobs, etc. that one would want to run in the background
> and not disrupt one's web browsing experience.

Not exactly what you're asking for, but I've previously used
http://lartc.org/wondershaper/ with great success to let my interactive
ssh sessions (e.g. decrease latency) get priority over bulk downloads

However, it hasn't been updated in a _long_ time and I'm not even sure
it helps much today.

-- 
Jon Solberg (remove "nospam." from email address).
0
Reply Jon 2/1/2010 3:19:11 PM

On Mon, 01 Feb 2010 15:03:56 +0000, Tristan Miller wrote:

> How is iptables going to know which is which?

How do you know which is which and how does your broswer know which
is which and YasT know which is which?

You would have to configure IPTABLES to use a combined rule limiting the 
urgency of packets which are of both type HTTP and coming from the 
address of the YaST repository.

> I want it to dynamically adjust itself, taking all the bandwidth
> when possible and cutting back when higher-priority processes
> are using it.

So you are looking for a automagical-does-all-I-want wonder tool.

Have you done a web search using such terms as "bandwidth limiter",
"traffic shaper", etc?

If you cannot find anything suitable they you are going to have to write 
the software yourself.
0
Reply J 2/1/2010 5:06:37 PM

Greetings.

In article <1265043997_77@vo.lu>, J G Miller wrote:

> On Mon, 01 Feb 2010 15:03:56 +0000, Tristan Miller wrote:
> 
>> How is iptables going to know which is which?
> 
> How do you know which is which and how does your broswer know which
> is which and YasT know which is which?

Because of how I invoke them on the command line.

When I invoke my browser, I will type the following:

$ seamonkey

And when I invoke YaST, and want to make sure that anything it downloads 
gets the lowest possible network priority, I will type the following 
(assuming the syntax of the hypothetical bandwidth-nicer is similar to that 
of ionice):

$ bwnice -c3 yast2

> You would have to configure IPTABLES to use a combined rule limiting the
> urgency of packets which are of both type HTTP and coming from the
> address of the YaST repository.

Well, that's hardly useful, since (1) I won't always know in advance what 
addresses are going to be accessed by the commands I want to bandwidth-
nice, and (2) even if I did know them in advance, it's entirely conceivable 
that I might run two different processes which download from the same 
address, but assign different bandwidth priorities to them.

> I want it to dynamically adjust itself, taking all the bandwidth
>> when possible and cutting back when higher-priority processes
>> are using it.
> 
> So you are looking for a automagical-does-all-I-want wonder tool.

No, I am looking for something that does exactly the same thing as nice or 
ionice, except with network bandwidth.  You do realize how these commands 
work, do you not?  A process which is ioniced, for example, will happily 
read and write from the disk as much as it can, unless it determines that 
another process with a higher priority wants to read or write, in which 
case it will wait until that process is done before resuming its I/O.  No 
"magic" is necessary; it's a simple matter of launching processes through 
ionice which assigns them to an appropriate priority queue.

> Have you done a web search using such terms as "bandwidth limiter",
> "traffic shaper", etc?

Of course, but all I found were programs that fixed a process's bandwidth 
usage to a specified rate.  That's why I'm asking here.

Regards,
Tristan

-- 
   _
  _V.-o         Tristan Miller          ><  Space is limited
 / |`-'  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-  <>  In a haiku, so it's hard
(7_\\    http://www.nothingisreal.com/  ><  To finish what you
0
Reply Tristan 2/1/2010 9:58:34 PM

On Mon, 01 Feb 2010 21:58:34 +0000, Tristan Miller wrote:
> Of course, but all I found were programs that fixed a process's
> bandwidth usage to a specified rate.

So you did not find MasterShapper

<http://www.mastershaper.org/index.php/MasterShaper>

which appears (from the screenshots) to allow the administrator to set 
priorities on transfers?

Perhaps you could ask in their web forum if you need to check on
specific functionality if it is not mentioned in the documentation (pdf).

> That's why I'm asking here.

That's fine, it is just nice to no if you have looked and to know
what is available is not suitable because of your requirements.
0
Reply J 2/1/2010 10:38:24 PM

6 Replies
219 Views

(page loaded in 0.138 seconds)

Similiar Articles:













7/16/2012 3:28:47 AM


Reply: