Posted: Fri Oct 13, 2006 10:26 Post subject: Traffic shaping
Is it possible to do traffic shaping with DD-WRT, i.e. something like what cFosSpeed does, but on router level?
The actual issue here is that almost any upload traffic, above say 2Kb/s, brings down download speed from 2Mbit/s to about 5Kb/s. Traffic shaping/packet scheduling (i.e. cFosSpeed) seems to do the trick, but since there is more than one computer using the router, I need some computer independent solution.
Also, is there some explanation to this behavior? Someone seemed to think that ACK packages get clogged up in the pipe (so to speak) for some reason.
Joined: 20 Jun 2006 Posts: 65 Location: United Kingdom
Posted: Mon Oct 16, 2006 15:05 Post subject:
Check out DD-WRT's built in QoS options, which is traffic shaping in other words. It does work very well once you get the setup right, but it'll take a bit of tinkering.
Quality of Service is interesting, except that (as I understand it) it seems that you actually reserve a bit of bandwidth for certain application. That isn't a very good solution seeing as I don't really want to cap say an FTP transfer at 85% of max speed unless I have something that wishes to use the other 15%. I'm looking for two things:
1) A solution similar to process priority in an operating system: FTP transfers would be slightly below normal priortity, VOIP slightly above normal.
2) Some way of balancing incoming and outgoing traffic. Somehow outgoing and incoming traffic seems to compete with each other, with outgoing always winning. If there is an upload, any downloads will be practically halted until there is not outbound traffic anymore. I have no idea why this is.
Actually, cFos worked quite well for me. At least I can have inbound and outbound traffic at the same time now (although it is still capped at say 25kb/s in each direction, about 1/10th of capacity). But that "solution" only works for one computer, not many.
actually, cfosspeed developers have promised a distributed version a long time ago, so it must be release soon. That version will do what you want: traffic shaping for multiple computers connected to a router.
it's not that hard, all they have to do is implement a communication protocol between all lan computers, all cfosspeed will share info like what bandwidth is available, what is required and then act on that information. The bottleneck is always the wan connection, not the lan connection, so they can "talk" all they want.
Quality of Service is interesting, except that (as I understand it) it seems that you actually reserve a bit of bandwidth for certain application. That isn't a very good solution seeing as I don't really want to cap say an FTP transfer at 85% of max speed unless I have something that wishes to use the other 15%.
Not at all. The reason you set your bandwidth slightly below the real value is to give it a bit of leeway for overhead.
zodiachus wrote:
1) A solution similar to process priority in an operating system: FTP transfers would be slightly below normal priortity, VOIP slightly above normal.
This is exactly what QoS does. You can set priorities for protocols, ip's, mac's, and physical ports. You'll want to set rules for all of your file transfer protocols to be bulk traffic and your voip should be set as premium traffic. Use extreme caution setting anything to exempt because QoS will then allow it to eat as much bandwidth as it wants.
zodiachus wrote:
2) Some way of balancing incoming and outgoing traffic. Somehow outgoing and incoming traffic seems to compete with each other, with outgoing always winning. If there is an upload, any downloads will be practically halted until there is not outbound traffic anymore. I have no idea why this is.
Your computer has to acknowledge that it received a chunk of data that was sent to you. To do that it has to send a small message to the other computer which uses a tiny portion of your upstream. If your upstream is flooded then these acknowledgments get delayed which causes the other end to send to you slower because it realizes you can't handle it. On a symmetric connection (upstream/downstream are the same) this is never really a problem but with asymmetric connections where upstream is usually a small fraction of downstream then it becomes hard to do both at the same time because you end up using most of your upstream just to send acknowledgments for your downloads. You can use QoS to maximize traffic in both directions if different protocols are using the bandwidth in different directions but if a single protocol is eating both then it's up to the application to shape its own traffic to do this. For example if you were downloading with http but uploading with ftp then you could give http a higher priority than ftp but if you were uploading and downloading with bit torrent then QoS couldn't do anything.
it's not that hard, all they have to do is implement a communication protocol between all lan computers, all cfosspeed will share info like what bandwidth is available, what is required and then act on that information. The bottleneck is always the wan connection, not the lan connection, so they can "talk" all they want.
This is true. However, a solution like this would increase the traffic between computers, which is fine as long as you don't have many of them. But the number of connections would increase with the number of computers according to the Wolfram sequence (i think). Two computers means one connection, three computers means three connections, four computers means six connections and so on. For a network with 20 computers we would have 4794 connections constantly open in order to maintain balance. Probably not good. (Unless you assign one computer as a contact point of some sort.)
phuzi0n wrote:
Your computer has to acknowledge that it received a chunk of data that was sent to you. To do that it has to send a small message to the other computer which uses a tiny portion of your upstream. If your upstream is flooded then these acknowledgments get delayed which causes the other end to send to you slower because it realizes you can't handle it. On a symmetric connection (upstream/downstream are the same) this is never really a problem but with asymmetric connections where upstream is usually a small fraction of downstream then it becomes hard to do both at the same time because you end up using most of your upstream just to send acknowledgments for your downloads. You can use QoS to maximize traffic in both directions if different protocols are using the bandwidth in different directions but if a single protocol is eating both then it's up to the application to shape its own traffic to do this. For example if you were downloading with http but uploading with ftp then you could give http a higher priority than ftp but if you were uploading and downloading with bit torrent then QoS couldn't do anything.
I see, thanks for the answer. So basically there is no way to universally prioritize the acknowledgment packets?
This is true. However, a solution like this would increase the traffic between computers, which is fine as long as you don't have many of them. But the number of connections would increase with the number of computers according to the Wolfram sequence (i think). Two computers means one connection, three computers means three connections, four computers means six connections and so on. For a network with 20 computers we would have 4794 connections constantly open in order to maintain balance. Probably not good. (Unless you assign one computer as a contact point of some sort.)
OR, you could use broadcast/multicast packets and keep only one "connection" per computer.
I see, thanks for the answer. So basically there is no way to universally prioritize the acknowledgment packets?
None supported by DD-WRT as far as I can tell. It's something that could probably be added very easily if the QoS app uses some sort of config file to identify different types of traffic but I haven't dug into the source to see what app is used for QoS or how easily it can be configured.