LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 10-13-2005, 05:08 PM   #1
tvynr
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 143

Rep: Reputation: 15
What Traffic Shaping Approach for Interactivity?


Hi, there! I've been retuning my router for a new home network lately and the demands of the other users are really pushing my traffic shaper to its limits. While we're still able to get fairly reasonable access to web pages and the like, the connection is behaving like a modem for things like SSH and games, not like a 1.5/768 cable line. This script worked fine when I was the only one beating it up, but it seems that it needs a bit more work to handle the new requirements.

The problem is that we are all bandwidth fiends, BitTorrent being the primary culprit. The original approach was to split the connection into three queuing disciplines. Handles 1:1 and 1:2 were SFQ and 1:3 was a TBF with a cap upstream speed at about 80% of our maximum upload capacity. This worked fine until the data really started coming down.

After all, there's not much I can do to regulate the downstream, right? I tried to do so anyway; I started policing traffic leaving my router's internal interface as well, hoping that the remote TCP/IP stack would get the idea when it stopped receiving ACKs and back off a bit. This was less than successful; there was little change.

Then it occurred to me that the ACK packets for the batch connections (BitTorrent, FTP data, etc.) were higher priority than the interactive connection data (data for SSH, Diablo II, etc.). So I created a new, much more complex heirarchy for both interfaces:

Code:
                         +-------+
                         | prio  |
                         |   1   |
                         +-------+
                           | | |
              +---1:1------+ | +---1:3-- (unused)
              |             1:2
              |              |
          +-------+      +-------+          +-------+
          | prio  |      |  tbf  |---12:1---| prio  |
          |  11   |      |  12   |          |  121  |
          +-------+      +-------+          +-------+
            | | |                             | | |
    +-------+ | +---11:3-- (unused)   +-------+ | +---121:3-- (unused)
  11:1      11:2                      |         |
    |         |                       |         |
+-------+ +-------+               +-------+ +-------+
|  sfq  | |  sfq  |               |  sfq  | |  sfq  |
|  111  | |  112  |               | 1211  | | 1212  |
+-------+ +-------+               +-------+ +-------+
Interactive ACK as well as SSH were routed to 111. Interactive connections of other kinds were routed to 112. Batch ACK and all SYN were routed to 1211. All other batch was routed to 1212.

If anything, this was worse, but I don't understand why. My understanding of the "prio" qdisc suggests to me it's a strict priority queue; if interactive data is waiting to be sent, it will go next, regardless of how much batch data there is or how long its been waiting. But no dice.

Has anyone dealt with this before? Does anyone have any suggestions? Moderating the downstream of each individual machine is inefficient as well as impractical, so I'm trying to determine some way to handle this all from the router.

Any advice will be appreciated quite a lot. I've kind of exhausted my list of ideas.

Cheers!
 
Old 10-13-2005, 07:38 PM   #2
SirGertrude
Member
 
Registered: May 2004
Location: Missouri
Distribution: Gentoo
Posts: 59

Rep: Reputation: 15
From what I understand your problems come from a saturated downstream connection. Using policing and/or shaping you should be able to keep your upstream under control.

Here is my input on your issue:

Policing downstream traffic works if you have a 1:1 TCP connection.

Example: You are downloading a file from a sourceforge.net mirror. You have a single connection between you and that mirror. If you are policing the inbound data you essentially drop excess packets causing the TCP protocol to adjust window sizes and slow down the transfer. This is effective because windowing is done between you and a single host.

The problem I see is policing traffic from multiple sources as in torrent downloads.

Example: If you have 20 people sending you torrent data that means you have 20 open connections each with different window sizes, etc. Obviously you are limiting bandwidth based on destination in this case� whether it be IP address or port (port being the best option). When the policer drops packets, it is not done in any uniform manor� they are just dropped when the speed is in excess of its limit. If you drop 300 packets they may have all come from a single host. This would mean that the other hosts would increase their windows sizes and send more data. It would be a never ending battle b/c from the sending hosts perspective there is no consistent packet loss� only random packet loss. Some hosts would send faster while others would send slower for a short period of time. This seems very inefficient as your users will only see a small percentage of their overall traffic while a huge percentage is dropped at your expense.

The solution:

I don�t know, I could only assume that the bandwidth limiter in your torrent program is more efficient in its limiting abilities.

Now keep in mind that this is all theory, I just brewed this up in my head. This may not be how things happen, and if I am way off on my thinking let me know. If this is correct then I would be interested in knowing how to address the problem, or at least mitigate it. My goal here is to shed some light on the topic so people smarter than me can offer a solution.

I hope this gets us some answers
 
Old 10-13-2005, 08:28 PM   #3
tvynr
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 143

Original Poster
Rep: Reputation: 15
Actually, your description of the problem seems to be what I witnessed. I monitored the download speed of one of the BitTorrent clients and observed it decreasing when I implemented the download policing solution. However, the overall traffic on my interfaces did not change significantly and interactivity was still low... actually, it seemed to get a bit worse.

I appreciate your thoughts on this matter. It's nice to have independent confirmation of my own suspicions, at the very least. You are correct in that the upstream is controllable (it is presently controlled quite well).

The thing that confuses me about this is that there must be a solution. After all, I've seen a number of large networks (such as the one at my old college) with thousands of users; they have successfully screened downstream traffic so as to allow interactivity despite a great deal of network beating by the users themselves. So there is a solution... we just need to find it.

Thanks again for your response. If I discover anything I will, of course, post it here.

Cheers!
 
Old 10-14-2005, 08:21 AM   #4
rlh989
LQ Newbie
 
Registered: Jun 2005
Posts: 10

Rep: Reputation: 0
how to deal with BT traffic

http://l7-filter.sourceforge.net/

This works very well when setup right, i leave BT client on full time and browsing and games are just fine latency wise. The only problem is now BT is starting to encrypt headers which makes this approach fail for now.... Very few BT clients can do this thou atm...
 
Old 10-14-2005, 02:18 PM   #5
tvynr
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 143

Original Poster
Rep: Reputation: 15
Thank you for your response. I am a bit confused, however. Presently, I am not having any trouble identifying the traffic (since my users are willing to stay on a set of predetermined ports). The problem is that the traffic is saturating my downstream and I'm not sure how to regulate this. Are there any specific parameters of setup that you use? Or have I misunderstood the purpose of the filter?

Thank you for the link regardless. If I start having trouble with misidentified traffic (people setting their BitTorrent server port to port 80 or something) then this will be very handy.

Cheers!
 
Old 10-15-2005, 08:28 AM   #6
s_c_braithwaite
LQ Newbie
 
Registered: Feb 2003
Posts: 2

Rep: Reputation: 0
Traffic Shaping for interactivity.

A Mice and Elephants queueing discipline should be most suitable for interactive traffic.

Unfortunately Bit Torrent creates so many flows. with different port and ip numbers, so it would be a most difficult case. However, you may want to look at the following link:-

http://www.sci.usq.edu.au/staff/brai...roj/index.html
 
  


Reply



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
Traffic shaping (limiting outgoing bandwidth of all TCP-traffic except FTP/HTTP) ffkodd Linux - Networking 3 10-25-2008 12:09 AM
Traffic Shaping jrmann1999 Linux - Networking 3 10-23-2008 12:43 PM
Traffic Shaping SchwipSchwap Linux - Newbie 2 10-23-2008 12:42 PM
Traffic Shaping nemesisza Linux - Networking 1 03-21-2004 05:52 PM
Traffic Shaping ?? DocKane Linux - Networking 2 08-24-2001 09:32 AM

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

All times are GMT -5. The time now is 04:40 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