[gentoo-user] traffic shaping and p2p
I've a small home network, actuall consisting of two gentoo boxes, where one box acts as router, firewall, svn server and desktop for my sister (i know this isn't an optimal setup) and the other one is my workstation. Now, when i start a p2p app on my workstation the latency of my internet connection suffers greatly, allthogh i've 384 kbit/s up and 3072 kbit/s down. I know that there are some approaches to solve this kind of problem by categorizing packets and assign different priorities to them, as explained at http://gentoo-wiki.com/HOWTO_Packet_Shaping. However, my knowledge of iptables and networking is very limited and i just want a simple and clean solution as i don't plan to trick myself by switching my p2p apps to non standard ports or manipulating the packet size ... To cut a long story short: I want high latency for ssh, browsing, subversion while offering p2p services a maximum of bandwidth in a small homenetwork containing only 2 boxes. Any suggestions ? Thanks, Matthias -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] traffic shaping and p2p
On Wed, 2005-12-14 at 20:02 +0100, Matthias Langer wrote: > I've a small home network, actuall consisting of two gentoo boxes, where > one box acts as router, firewall, svn server and desktop for my sister > (i know this isn't an optimal setup) and the other one is my > workstation. > > Now, when i start a p2p app on my workstation the latency of my internet > connection suffers greatly, allthogh i've > 384 kbit/s up and 3072 kbit/s down. I know that there are some > approaches to solve this kind of problem by categorizing packets and > assign different priorities to them, as explained at > http://gentoo-wiki.com/HOWTO_Packet_Shaping. However, my knowledge of > iptables and networking is very limited and i just want a simple and > clean solution as i don't plan to trick myself by switching my p2p apps > to non standard ports or manipulating the packet size ... > > To cut a long story short: I want high latency for ssh, browsing, (what i mean is in fact low latency :-) > subversion while offering p2p services a maximum of bandwidth in a small > homenetwork containing only 2 boxes. > > Any suggestions ? > > Thanks, > Matthias > -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] traffic shaping and p2p
Matthias Langer wrote: Now, when i start a p2p app on my workstation the latency of my internet connection suffers greatly, allthogh i've 384 kbit/s up and 3072 kbit/s down. I know that there are some approaches to solve this kind of problem by categorizing packets and assign different priorities to them, as explained at http://gentoo-wiki.com/HOWTO_Packet_Shaping. However, my knowledge of iptables and networking is very limited and i just want a simple and clean solution as i don't plan to trick myself by switching my p2p apps to non standard ports or manipulating the packet size ... I've used that HOWTO (and contributed bits to it), and its great. But why can't you just limit your P2P application's upload speed? I mean, the program should have some controls that let you do that, right? I know every sane bittorrent app has this. -- [Name ] :: [Matan I. Peled] [Location ] :: [Israel] [Public Key] :: [0xD6F42CA5] [Keyserver ] :: [keyserver.kjsl.com] encrypted/signed plain text preferred -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] traffic shaping and p2p
On Thu, 2005-12-15 at 09:53 +0200, Matan Peled wrote: > Matthias Langer wrote: > > Now, when i start a p2p app on my workstation the latency of my internet > > connection suffers greatly, allthogh i've > > 384 kbit/s up and 3072 kbit/s down. I know that there are some > > approaches to solve this kind of problem by categorizing packets and > > assign different priorities to them, as explained at > > http://gentoo-wiki.com/HOWTO_Packet_Shaping. However, my knowledge of > > iptables and networking is very limited and i just want a simple and > > clean solution as i don't plan to trick myself by switching my p2p apps > > to non standard ports or manipulating the packet size ... > > I've used that HOWTO (and contributed bits to it), and its great. > > But why can't you just limit your P2P application's upload speed? I mean, the > program should have some controls that let you do that, right? I know every > sane > bittorrent app has this. > Well, i use azureus - and of course i know that upload-speed can be limited - which is maybe in fact the best solution to my problem. However, what i have in mind is somehow similar to cpu-resources and process-priority. If i start at process with nice level 15, it will get all available cpu-resources without slowing down the other apps. As far as i understand, this is not the same as limiting the process to, say 80% of cpu power. Now, what i want is the same for p2p apps - give them as much bandwidth they can reasonably get but don't let them slow down firefox, ssh etc. Because i want this setup just for my homenetwork, it would perfectly suffice if packages get their priorities by examining port-numbers. And because i want to at least partially understand what i'm doing i would prefer a simple and clean setup. I know that in principle the neccessairy steps to do what i wannt can be found in the 'Packet Shaping HOWTO'. But i wanted to hear experiences and opinions of others first before starting messing around with my router. By the way, there are many different packet shedulers in the kernel - and the HOWTO only explains the HTP-scheduler. What about the other schedulers - can they be usefull for my purposes too - and if yes, how can they be configured and used ? Matthias -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] traffic shaping and p2p
Matthias Langer schreef: > Now, what i want is the same for p2p apps - give them > as much bandwidth they can reasonably get but don't let them slow down > firefox, ssh etc. In the case of Azureus specifically, your problem is actually not with Azureus, but with Java (that's what's slowing down, and further what is likely to be slowing down Firefox as well if it's running. Certainly I find that running both Firefox and Azureus together is the fast road to The System of Molasses). You might consider aliasing Java to run at a "good" niceness (in ~/.bashrc) alias java="nice -n 15 java" so that when Azureus starts the (many, many) Java processes that it uses, they will be niced to something you can live with. What effect this will have on Firefox, I cannot say, however. Just an idea, hope it helps, Holly -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] traffic shaping and p2p
On Thu, 2005-12-15 at 20:15 +0100, Holly Bostick wrote: > Matthias Langer schreef: > > > Now, what i want is the same for p2p apps - give them > > as much bandwidth they can reasonably get but don't let them slow down > > firefox, ssh etc. > > In the case of Azureus specifically, your problem is actually not with > Azureus, but with Java (that's what's slowing down, and further what is > likely to be slowing down Firefox as well if it's running. Certainly I > find that running both Firefox and Azureus together is the fast road to > The System of Molasses). Hmm, i can't confirm this, bacause as long as azureus is not down/uploading heavily browsing is not really affected. But this may differ from java-vm to vm. I use sun-jdk-1.5.05 because i do same java programming stuff ... > > You might consider aliasing Java to run at a "good" niceness > > (in ~/.bashrc) > > alias java="nice -n 15 java" > > so that when Azureus starts the (many, many) Java processes that it > uses, they will be niced to something you can live with. > > What effect this will have on Firefox, I cannot say, however. > > Just an idea, hope it helps, > > Holly > But thanks for your answer nevertheless, Matthias -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] traffic shaping and p2p
On Dec 15, 2005, at 5:05 pm, Matthias Langer wrote: Well, i use azureus - and of course i know that upload-speed can be limited - which is maybe in fact the best solution to my problem. ... for p2p apps - give them as much bandwidth they can reasonably get but don't let them slow down firefox, ssh etc. Because i want this setup just for my homenetwork, it would perfectly suffice if packages get their priorities by examining port-numbers. And because i want to at least partially understand what i'm doing i would prefer a simple and clean setup. I haven't used it yet, but my understanding of traffic-shaping is that it's exactly what you want. I believe that other quality-of-service mechanisms may require applications to be QoS aware (setting a QoS bit in the packet header). You're absolutely right in that reducing the bandwidth of the p2p app isn't the ideal way to achieve what you want - I find latency in browsing & surfing with BitTorrent consuming only 60% - 70% of my upload - it doesn't help that other peers are continually making requests of you. If you lower the bandwidth consumption in Azureous then you have to remember to up it again when you go to bed - traffic shaping WILL allow you to permanently maximise your p2p bandwidth, with the ROUTER reducing it only when your priority services send packets. I know that in principle the neccessairy steps to do what i wannt can be found in the 'Packet Shaping HOWTO'. By the way, there are many different packet shedulers in the kernel - and the HOWTO only explains the HTP-scheduler. What about the other schedulers - can they be usefull for my purposes too - and if yes, how can they be configured and used ? No idea. I hope you'll give us feedback when you've discovered more. Stroller. -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] traffic shaping and p2p
On Dec 15, 2005, at 7:15 pm, Holly Bostick wrote: Matthias Langer schreef: Now, what i want is the same for p2p apps - give them as much bandwidth they can reasonably get but don't let them slow down firefox, ssh etc. In the case of Azureus specifically, your problem is actually not with Azureus, but with Java ... You might consider aliasing Java to run at a "good" niceness Hi Holly, Matthias seems to have confused the issue with his "bandwidth niceness" analogy. I believe that his problem are with saturation of his broadband connection, in which case he'd get the same problem even if Azureus was running on a different PC from his web-browser. Matthias wants to give p2p maximum bandwidth & have the router sort it out so that he gets no latency on other connections - this is what traffic-shaping does. Stroller. -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] traffic shaping and p2p
>From the sounds of things it looks like this is a problem with network latency, not any issue with his computer. One of the first things that should be done to help would be adjust the settings in Azureus for your specific up/dl speeds. This is a pretty good guide to get started on that. http://azureus.aelitis.com/wiki/index.php/Good_settings The other thing I would recommend doing is using the plugin "Auto Speed". This plugin will automatically adjust your dl & ul speeds according to the network latency. Note, If your router blocks or rejects ICMP then you will not be able to use the plugin.
Re: [gentoo-user] traffic shaping and p2p
On Fri, 2005-12-16 at 13:08 +, Stroller wrote: > On Dec 15, 2005, at 5:05 pm, Matthias Langer wrote: > > > > Well, i use azureus - and of course i know that upload-speed can be > > limited - which is maybe in fact the best solution to my problem. > > ... for p2p apps - give them > > as much bandwidth they can reasonably get but don't let them slow down > > firefox, ssh etc. Because i want this setup just for my homenetwork, it > > would perfectly suffice if packages get their priorities by examining > > port-numbers. And because i want to at least partially understand what > > i'm doing i would prefer a simple and clean setup. > > I haven't used it yet, but my understanding of traffic-shaping is that > it's exactly what you want. I believe that other quality-of-service > mechanisms may require applications to be QoS aware (setting a QoS bit > in the packet header). > > You're absolutely right in that reducing the bandwidth of the p2p app > isn't the ideal way to achieve what you want - I find latency in > browsing & surfing with BitTorrent consuming only 60% - 70% of my > upload - it doesn't help that other peers are continually making > requests of you. If you lower the bandwidth consumption in Azureous > then you have to remember to up it again when you go to bed - traffic > shaping WILL allow you to permanently maximise your p2p bandwidth, with > the ROUTER reducing it only when your priority services send packets. > > > I know that in > > principle the neccessairy steps to do what i wannt can be found in the > > 'Packet Shaping HOWTO'. By the way, > > there are many different packet shedulers in the kernel - and the HOWTO > > only explains the HTP-scheduler. What about the other schedulers - can > > they be usefull for my purposes too - and if yes, how can they be > > configured and used ? > > No idea. I hope you'll give us feedback when you've discovered more. Ok i found out that in fact the HFSC scheduler should be the one which does exactly what i like because it handles bandwidth and latency seperatley. Here is my current setup, which seems not to be ideal - ssh is still slow when my upload is high: # create the following tree # 1: # 1:1 # 1:10 1:20 1:301:40 # where 1:10 is for ssh, 1:20 for svn, 1:30 for surfing and 1:40 for unmatched traffic # creates the root qdisc tc qdisc add dev eth0 root handle 1: hfsc default 40 # node 1:1 tc class add dev eth0 parent 1: classid 1:1 hfsc sc rate 441kbit ul rate 441kbit # node 1:10 (ssh) - guaranty 1500b in 20ms with an overarall rate of 88kbit tc class add dev eth0 parent 1:1 classid 1:10 hfsc sc umax 800b dmax 20ms rate 88kbit # node 1:20 (svn) - guaranty 1500b in 30ms with an overall rate of of 147kbit tc class add dev eth0 parent 1:1 classid 1:20 hfsc sc umax 800b dmax 30ms rate 147kbit # node 1:30 (firefox) - garanty 2b in 100ms with an overall rate of 120kbit tc class add dev eth0 parent 1:1 classid 1:30 hfsc sc umax 2b dmax 100ms rate 120kbit #node 1:40 (unmatched) tc class add dev eth0 parent 1:1 classid 1:40 hfsc sc rate 96kbit # now that we have our qdiscs we need filters for them # ssh tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip dport 22 0x flowid 1:10 # svn tc filter add dev eth0 protocol ip parent 1: prio 2 u32 match ip dport 3690 0x flowid 1:20 # firefox tc filter add dev eth0 protocol ip parent 1: prio 3 u32 match ip dport 80 0x flowid 1:30 Note that i use the u32 filter (must be enabled in the kernel) and not iptables. By the way, there is a very interesting article about traffic control with qdiscs and different schedulers, in particular HFSC, written by the author of HFSC himself in the german 'Linux Magazin' 02/2005. I'll tell you about further experiences with HFSC - comments and suggestions are welcome. Matthias -- gentoo-user@gentoo.org mailing list