LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-18-2014, 01:39 AM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,667

Rep: Reputation: 187Reputation: 187
Trying to use tc to throttle download speed


I need some help with tc. I have a backup computer to which backups are sent, sometimes taking a couple of days. During the day, the target host needs to share bandwidth with other people working in the office. According toftop, normal download speed appears to be about 15Mb which is just about the entire download bandwith from the ISP. No one can do any browsing or download on other workstations when this is running.

I've tried running the tc commands:

$ tc qdisc add dev eth0 handle ffff: ingress

$ tc filter add dev eth0 parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate 500mbps burst 1m drop flowid :1

Which reduces the download speed to about 2Mb. It seems that no matter what I set the rate to, whether 5mpbs, 50mpbs or 500mbps, it always reduces input to 2-ish Mb. I've also tried different values for the burst size.

I'd like the rate to be about 8Mb. How do I fix this?
 
Old 12-18-2014, 05:50 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
How are the backups being sent? If it's via scp, rsync, etc. you can throttle it in the command itself. Eg:
Code:
rsync --bwlimit=1024
scp -l 8192
 
Old 12-18-2014, 11:35 PM   #3
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,667

Original Poster
Rep: Reputation: 187Reputation: 187
Thanks, but I've done the rsync --bwlimit thing. The problem with that is that multiple remote backups for different systems can run concurrently and each rsync's bwlimit would be additive. Also, the bwlimit stays set until the rsync completes, which may be after a few days. tc lets me change throughput whenever I want, so a cron job will boost the throughput after business hours and on weekends.

I think tc is the way to go, I just can't seem to get the rate specified correctly.
 
Old 12-20-2014, 04:06 PM   #4
monohouse
Member
 
Registered: Oct 2004
Distribution: Arch
Posts: 206

Rep: Reputation: 30
ingress QoS is ineffective from what I've heard because the packets have already arrived to the machine.

you are much better off performing egress QoS on the computer from which the backups are sent, it is both significantly more effective and easier to do

the best option is to instruct the backup application on the computer from which the backups are sent to throttle the upload speed, then you would not need to use QoS at all

Last edited by monohouse; 12-20-2014 at 04:11 PM.
 
Old 12-23-2014, 01:46 AM   #5
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,667

Original Poster
Rep: Reputation: 187Reputation: 187
> ingress QoS is ineffective from what I've heard because the packets have already arrived to the machine.

Yes, but it works by dropping the packets and the sender then adjusts. I do plan on investigating the egress method, but I don't see it being easier since it will limit ALL egress, not just rsync. Therefore email, web pages, etc. get limited unless I make different queues for different packet type -- suddenly not so simple.

So, you think I cannot do any "tuning" on the ingress rate?
 
Old 12-24-2014, 07:02 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by monohouse View Post
ingress QoS is ineffective from what I've heard because the packets have already arrived to the machine.
you are much better off performing egress QoS
Correct!


Quote:
Originally Posted by mfoley View Post
Yes, but it works by dropping the packets and the sender then adjusts.
No, "shaping" queues and prioritizes traffic so that effectively it uses less bandwidth than available. Think of a sluice that's only half open.


Quote:
Originally Posted by mfoley View Post
I do plan on investigating the egress method, but I don't see it being easier since it will limit ALL egress, not just rsync. Therefore email, web pages, etc. get limited unless I make different queues for different packet type -- suddenly not so simple.
Actually iptables does make this simple using "all except" / "and not" type of filtering. Consider having two queues and two iptables rules to tag traffic and to set a default tag. This will automagically make non-tagged traffic get the default tag which you prioritize to use all available (or say ninety per cent of all) bandwidth.
 
  


Reply

Tags
tc


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i speed up my download speed on a broadband connecxion dgfi Linux - Newbie 2 03-01-2014 01:43 PM
Upload speed limiting to increase download speed dangerousdave Linux - Networking 6 02-16-2010 03:19 PM
Why is my internet upload speed greater than my download speed? km4hr Linux - Networking 1 05-27-2008 08:33 PM
Rtorrent Upload/Download throttle KOTAPAKA Linux - Networking 0 03-01-2008 03:19 PM
Nvidia drivers causing GPU fan to throttle to full speed. jcmkk Linux - Hardware 2 04-14-2005 02:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration