1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

QoS smashing my downloads?

Discussion in 'Tomato Firmware' started by Meffy, Dec 22, 2008.

  1. Meffy

    Meffy LI Guru Member

    My torrents are all under low and when i run them my download speed drops by 50%-40%.Stopping the torrents(Seeding) lets me hit 100% back again...Any suggestions?
     

    Attached Files:

    • Help.jpg
      Help.jpg
      File size:
      21.4 KB
      Views:
      218
  2. tievolu

    tievolu Network Guru Member

    What's your outbound bandwidth? I see from the screen grab that you've got it set to 768Kbits/s - is that your actual rated bandwidth? If so, you probably want to reduce it to ~90% e.g. 700Kbits/s, or maybe lower, depending on how stable your connection is. Try doing a few speed tests with QOS disabled to see what kind of outbound bandwidth you actually get.

    If you set your outbound bandwidth too high QOS won't work because it thinks it has more headroom than it actually does - it tries to assign non-existent bandwidth, and everything slows down. You have to be conservative and accept that you're going to lose a little bandwidth. That's the price you have to pay to get QOS to work properly.

    EDIT: Also, enable ACK prioritisation.
     
  3. Meffy

    Meffy LI Guru Member

    Thats my actual rated bandwidth.I can easily max it with qos disabled..So are you suggestion i set it to something round 700 and set all the priorities to something like xx-100%?
     
  4. tievolu

    tievolu Network Guru Member

    Yep, that's exactly what I mean. And prioritise the ACK packets as well - that will help with download speeds even if you're maxing out your upstream.
     
  5. Toastman

    Toastman Super Moderator Staff Member Member

  6. Meffy

    Meffy LI Guru Member

    Interesting read but if they work together shouldnt we just shove 1-100% for everything and set outbound to something lower then our max?
     
  7. tievolu

    tievolu Network Guru Member

    That would effectively disable QOS. If you have your settings like this:

    Code:
    Highest	    1% - 100%
    High	    1% - 100% 
    Medium	    1% - 100%
    Low	    1% - 100%
    Lowest	    1% - 100%
    
    it means that if you're maxing out your upstream with all types of traffic, it will be shared equally between all classifications. That's basically means you're not using QOS at all, because no traffic has priority over anything else - there's no point in classifying anything. Also note that each connection would get an equal share - if you have lots of torrent connections they'll overpower everything else and get the vast majority of the bandwidth.

    To get QOS working you need to prioritise each classification. For example:

    Code:
    Highest	    74% - 100%
    High	    15% - 100% 
    Medium	    8% - 100%
    Low	    2% - 100%
    Lowest	    1% - 100%
    
    This means that if the upstream is flooded with traffic of all classifications, traffic classified as Highest is guaranteed to get 74% of the bandwidth if it needs it, High is guaranteed 15% if it needs it, etc. down to Lowest which is only guaranteed 1%. This means that higher priority traffic will take preference over the Lower classifications.

    For this to work correctly in all situations the numbers on the left must add up to 100%, and the total bandwidth that 100% represents (e.g. 700kbits/s) must be available all the time - if not, QOS will not work properly as discussed before.

    For example, if you're uploading torrents you can still have a decent VOIP call because if you classify VOIP as Highest it's guaranteed to get around 74% of the upload bandwidth (the exact figure depends on what other Highest classified traffic is present). All those hundreds of torrent connections, if classified as Lowest, are only guaranteed to have a total of 1% of the bandwidth. If other bandwidth is available (i.e. if the High, Medium and Low classifications are not using their guaranteed shares), it will be shared equally between the classifications that are present. So if you only had VOIP and torrent traffic with the above settings, VOIP would get 74%, torrent traffic would get 1%, and they would share the "spare" 25% equally (in reality torrent traffic would almost certainly get a bigger chunk of the 25%, because there would probably be many more torrent connections that VOIP connections).

    If you change the numbers on the right you are specifying a maximum bandwidth for a classification. In my opinion if QOS is working properly you generally don't need to do change those values from 100% - why not let torrent traffic have 100% of the upstream if nothing else is using it?

    Note: This is based on my own experience - i.e. I think this is how it works anyway... :)
     
  8. spicoli

    spicoli LI Guru Member

    What about the ones on the right?

    EDIT: rofl typos
     
  9. Toastman

    Toastman Super Moderator Staff Member Member

    QOS rate and Limit settings

    tievolu, you're forgetting the classes also prioritize traffic. So in theory at least, if all classes were given 1% - 100% for rate and limit, if the highest class was in use it would be able to take 100% of the upload bandwidth - this is the point meffy was making.

    But this would not necessarily be the right thing to do, especially in the case of a P2P class. Allowing unlimited outgoing traffic without considering it's effect on the incoming data stream can often totally break QOS. And there is also some question of "overstating" of the QOS rate being necessary for a decent response time.

    See here:

    http://www.linksysinfo.org/forums/showpost.php?p=337410&postcount=2
     
  10. tievolu

    tievolu Network Guru Member

    But wouldn't everything else be able to take 100% as well? I thought that if you specify 1-100% for every class, each of them is only guaranteed 1% of the bandwidth - is that not correct?

    I thought that the values you specify in these boxes are the very basis for the prioritisation - i.e. that the values here define how your upstream traffic is dished out. If not, how much bandwidth will QOS give to each classification of traffic (if you make everything 1-100%)? Is that defined somewhere else? Or will the Highest class get 100% (even though you've specified that it's only guaranteed 1%)?

    Not sure what you mean. The values on the right can add up to anything - they are simply a rate cap for each class. If you set one of these values to, say, 70%, that class will never get more than 70% of the upstream, even when there is no other traffic.
     
  11. Toastman

    Toastman Super Moderator Staff Member Member

    There are two considerations - the first is PRIORITY of one class over another determines which one will be sent to the ISP first. Each class has a number, in tomato internally it is 0 to 9. Highest is 0 and lowest is 9. Class 0 (HIGHEST) would be sent to the ISP first, i.e. it would be pushed to the front of the queue. And so on ... until we reach the lowest (E).

    The second consideration is allocation of outgoing BANDWIDTH of each class, to attempt to shape traffic on the link so that incoming high-priority data from the remote servers will get priority over the lower classes. The only way our router has to do this is actually to slow down that other traffic, and that is also a function of QOS. It is actually a crude form of congestion control.

    To recap - in order to work, the QOS system as a whole, uses both priority and bandwidth control to influence incoming data so that your high priority traffic will not be delayed.

    The % value in the "limit" is the bandwidth that class is allowed to take in excess of it's "guaranteed" minimum (rate) if no other application is using that bandwidth, or has a lesser priority (i.e. - is in a lower class).

    If everything were set as RATE 1 and LIMIT 100, and assuming that all traffic was trying to fight for whatever outgoing bandwidth it could get, then HIGHEST would win, and in theory should rise to 100% less the sum of the allocations of 1% for the other 9 classes = 91%. If no other class were using bandwidth at all it - then could rise to 100%.

    That's how most of us have interpreted the wikis...

    The observed behaviour is not always in accordance with our interpretations though, which is discussed here:

    http://www.linksysinfo.org/forums/showpost.php?p=337417&postcount=4


    Not correct. What would happen here is that "HIGHEST" would take 96% of outgoing bandwidth, the others 1% - in theory that is. Now of course, the BIG question is did you really want ANY class to take almost 100% of outgoing bandwidth? Didn't you actually want to give priority to the INCOMING data??

    If so, you need to think about that 100% "limit" and how it is going to affect that incoming data stream....
     
  12. Toastman

    Toastman Super Moderator Staff Member Member

    Quick QOS example for Meffy ...

    Meffy

    Your jpg is very small so can't really see what is in it. But let's have a quick try to improve things a bit. I'm assuming you want to prioritise your music and (wow?) followed by WWW, Chat and (man?) and P2P is low priority. [You have one machine's IP there in a low class - I don't know what that is, but you need to put that in a low class yourself, perhaps B]. And my interpretation of your posts is that your downloads (whatever) drop when your torrent client starts seeding (uploading files).

    I'm going to ignore the theory and go for something that quickly yields results that you can see.

    OUTBOUND MAX BANDWIDTH for 768k

    - put 500kbps in there for now - but you must measure your actual speed with an online speed test.

    INBOUND MAX BANDWIDTH - Oh, do I see 100Mbps? Your router can't handle that sort of speed. Did you mean 10Mbps?

    - put 8000kbps in there.

    OUTBOUND rate and limit

    highest___DNS________100 - 100
    high_____Wow/Music___100 - 100
    medium__WWW________50 - 100
    low______Man/IRC______10 - 50
    lowest___P2P___________1 - 5 (start at 5% and see what comes IN...)
    A________P2P uploads (seeding) 1 - 50 (allows 300k or so of outbound seeds)


    INBOUND limits

    highest NONE
    high NONE
    medium NONE
    low 50%
    lowest 90%
    A 5%

    CLASSIFICATION

    53 0-2kb DNS Highest
    3724,8080 ? Wow/Music High
    80 ? WWW Medium
    1803,6667-9 ? Man/IRC Low
    TCP/UDP 1024-65535 traffic of 50k + A

    Don't try to classify normal P2P downloads. It's covered by the default class and doesn't need any rules. If you have one machine that is only used for P2P you could classify it by MAC or IP into LOWEST, but then it's DNS will also be slowed up and it's no good for anything else. I'm using class A to move your P2P seeding (uploads) into a lower priority class so they don't affect your download speeds.

    Make sure the "prioritize ACKS" box is unchecked. Oh, and switch off Vegas - so it doesn't mask what is going on. It doesn't work anyway. Now you should see things working, look at your pie charts and realtime/24 hour graphs to see what's happened. Then you can start to tweak...

    You may need to limit the numbers your P2P connections to prevent overloading the router. These scripts go in admin/scripts/firewall. Change them to suit your requirements. DHT in uTorrent generally causes a lot of UDP connections. The UDP script will help, or you can turn off DHT. Some more useful scripts were posted previously.

    #Limit UDP connections per user
    iptables -I FORWARD -m iprange --src-range 192.168.1.10-192.168.1.250 -p ! tcp -m connlimit --connlimit-above 20 -j DROP

    #Limit TCP connections per user
    iptables -I FORWARD -p tcp --syn -m iprange --src-range 192.168.1.10-192.168.1.350 -m connlimit --connlimit-above 3100 -j DROP

    I'm not going to spend too much time on this - it's just a quick example to show you some ideas, how to approach the problem - because I really don't have a 100% understanding of your aims, but I do hope this does something you can use as a base.

    Good luck!
     
  13. pharma

    pharma Network Guru Member

    Meffy,

    Look in your Windows Event Log and see if you find a "4226" tcpip error appearing. If so you are having problems with the number of half-open connections allowed.

    Good news is there are methods to change this in both XP and Vista. Try a forum search on "4226" for more details.

    Pharma
     
  14. Meffy

    Meffy LI Guru Member

    Most of what have been said above,i have done them already.I have patched my tcpip.sys to prevent 4226 the moment i started using torrents.

    Torrent traffic isn't classified,i use the default option for qos to do that.My isp provides a 10mb dl but it allows 100mb to websites depending on the traffic at certain times

    The fact that they are classed as HIGHEST and HIGH just made me confused as i thought that 1-100% means that it will increase the upload above 1% only if the higher priority class is not using.Which in short if i set 1-100% for everything,if low is using 100% and should highest need 10%,low will fall to 90% to allow 10% for highest.Yes if something is hitting 100% of ur UL,it will slow the dl,which is why i was wondering if 1-100% for everything will work if i set the ul limit to like 700kb instead of 768kb.

    Secondly its the min and max thing which sounds weird.A total min value above 100%?Assuming that tomato DOES add up all the min values and divide them to ensure a 100% value.why make the router do the job when u can manually specific it and add up to 100% yourself?

    Maybe the highest high etc stuff just means move to traffic front but it follows the rule of min which means it will only allocate the min value should other classifications try and fight for more UL?That will make sense in the case of needing a above 100% min value.Any thoughts here?

    I have DHT disabled as its usually not needed as i only use private trackers.
     
  15. Toastman

    Toastman Super Moderator Staff Member Member

    Did you try inputting the setup details I suggested?

    If your ISP reckons you have 768k UP then in practice it will usually be something much less - did you measure it ? In Thailand most 512k uplinks measure at around 350-400k, for example. You cannot enter 768k - QOS cannot work.

    This question of 100mbps has really got me confused. Your router cannot handle 100Mbps.

    Secondly, you cannot enter the value that your ISP states as the maximum speed of his link anyway, as QOS will not work correctly. You must enter 85% - 90% of the LOWEST speed that you EVER get on the link. The only way to to do that is to switch off QOS and stop anything accessing the web, and do an online speed test. Enter 85% of the figure you get as a result and QOS will be able to work, the outbound figure is especially important. This isn't negotiable, it is a requirement and is clearly spelled out in all of the relevant documentation and wikis.

    If the ISP's 10Mbps downlink figure were accurate we would enter 850kbps in the "INBOUND LIMIT" box.

    If you read the article, it says why sometimes we overstate the minimum "rate" for a class. If you set the parameters manually yourself, you obviously want to set something which works. So watching the effect that 10% rate and 50% limit has on your WWW traffic, for instance, you might see that it is quite slow compared to no QOS being in use. That isn't right. Perhaps the initial burst of data sent to the remote HTTP site is in EXCESS of that 10% - thus the figure has to be recalculated and then the figure "slowly" begins to ramp upward towards that 50% maximum - therefore delaying the data. So - you would increase the "rate" paramter manually to compensate, to avoid this delay. Suppose that it turns out that 50% seems to be necessary for a fast HTTP response. OK - if you also do this to other classes for the same reasons - now your total is in excess of 100%. If that bothers you, so be it, but try it anyway :biggrin:

    Your understanding of the 1-100% for all classes is essentially correct. But if a session starts with a requirement to send several large packets quickly, to initiate a HTTP session for example, that 1% bandwidth will not be large enough and has to be increased, as you would expect - but this takes some time - that is why we increase the initial allocation. Try it, and experiment!
     
  16. Meffy

    Meffy LI Guru Member

    Thanks for the help here.I have done some of your suggestions but not all..yet.

    I have done several tests and it seems to hover around 700+ weirdly.I have limited my UL around 700k which fixed my problem.

    I do understand my router cannot handle 100mb dl and i am unsure what to put as my dl limit as my ISP does not really limit my connection based on what i pay...Example is that CERTAIN websites have the limit removed,allowing my connections to them to exceed 10mbs and hit 100mbs without counting as my dl rate.I do not know the max dl my router can handle so i simply shove a 100mb dl in it.

    Yes i have read the article,but it also stated that tomato MAYBE adds up these values and divides them to ensure a total is 100% which leads me wondering why make the poor router do more work.

    If i were to use theory on your post #12,wont it end up as having a -61 to 100% for highest cause of a min value of the other classes [100%-(100+50+10+1)%=-61%] resulting in a highest of -61 to 100%.Seems like our theory isnt really right here?

    The min max thing bothers me,but i'll still give it a try in a moment as im currently not at home.
     
  17. callous

    callous Network Guru Member

    I put my limits 1%-100% for all my classes - no problems even with bittorrent running.

    I tested the outbound bandwidth by testing dif values until they were maxing out my bittorrent - it's close to the theoretical max.

    By default the class is "lowest" and that's where bt goes.
     
  18. Toastman

    Toastman Super Moderator Staff Member Member

    Meffy, understand about the variable download limit. You should look in your ADSL setup and see what speed your modem actually connects at. I am quite sure it will not be 100Mbps... anyway, the problem is that Tomato and most other (if not all) SOHO routers cannot cater for variable bandwidths - they have no way to measure it automatically. You HAVE to put in the minimum bandwidth that you EVER measure. And no, the incoming limit is not what i was referring to in the article - which discussed the outbound rate and limit.

    Do you mean this was the result of an online speed test? Was this the uplink speed?

    If so, and it was really 700k, then you must put about 600k as your outbound MAX BANDWIDTH.
     
  19. Toastman

    Toastman Super Moderator Staff Member Member

    Something needs to be understood by all those using/having problems with P2P. It's extremely easy to get Bit Torrent to max out your bandwidth. All you have to do is to make a complete pig's ear out of setting up QOS. Or just turn it off.

    What isn't so easy is to get other applications to work acceptably in the presence of P2P. By "acceptable" I mean fast - essentially the same as your being connected directly to your modem. To achieve this you need to make compromises. That will normally mean limiting your P2P so that it can't make use of 100% of your bandwidth, in order to leave some room for fast operation of other classes. And that's why I wrote the articles!

    If you're a standalone user, then probably most of this doesn't really make much difference to you.
     

Share This Page