User Tools

Site Tools


qos

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
qos [2012/10/28 20:53]
pbix [link is saturated]
qos [2017/12/29 01:21] (current)
ispyisail [Router Performance]
Line 2: Line 2:
  
 ====== Quality of Service (QOS) ====== ====== Quality of Service (QOS) ======
-{{INLINETOC 2 4 }}   
  
 ===== Introduction ===== ===== Introduction =====
Line 15: Line 14:
  
 Let’s start by trying to identify when QoS might provide benefit for you. If for example you are already happy with your Internet experience then you do not need to use QoS or to read any further. However, if you play online games or use voice of internet technology then you know when someone else is watching youtube videos at the same time suddenly you get high pings and timeouts or very poor voice quality.  Another case might be that your roommate runs his bittorrent application constantly and your web Let’s start by trying to identify when QoS might provide benefit for you. If for example you are already happy with your Internet experience then you do not need to use QoS or to read any further. However, if you play online games or use voice of internet technology then you know when someone else is watching youtube videos at the same time suddenly you get high pings and timeouts or very poor voice quality.  Another case might be that your roommate runs his bittorrent application constantly and your web
-browsing suffers greatly because of it. Or you may administer a campsite and get complaints that some campers have good access but others are not getting their fair share. Having multiple people involved and fairness issues is when you can benefit from QoS. Fairness is the goal of the QoS system. We say QoS is being fair when it is able to enforce the rules you created for internet access.+browsing suffers greatly because of it. Or you may administer a campsite and get complaints that some campers have good access but others are not getting their fair share. Having multiple people, devices or programs involved is when you can benefit from QoS. Fairness is the goal of the QoS system. We say QoS is being fair when it is able to enforce the rules you created for internet access.  QoS is perhaps the only time in your life you get to decide what is fair. 
 + 
 +An important fact about fairness is that it has a cost.  In the case of QoS the cost will come in terms of reduced utilization of your WAN link.  Lots of work has been invested in making this cost as low as possible but you are going to take a 5-10% hit on your WAN throughput to get fairness.  This is the cost of QoS and if you do not want to pay it you can stop reading now.  When you are having the problems that QoS can solve you will be more than willing to give up 5% of your bandwidth to solve them.
  
 How about an analogy? I fly a lot and if you do too then you understand that when it’s time to board the airplane we do not just all rush at the door. The gate agent enforces the airline’s quality of service plan for each passenger. She starts by boarding handicapped folks, then we move onto the airline’s diamond members, then gold, silver and finally we arrive at the bulk class. In this analogy the gate agent is the router and the passengers are the packets of data trying to get through to the WAN. The point is that for How about an analogy? I fly a lot and if you do too then you understand that when it’s time to board the airplane we do not just all rush at the door. The gate agent enforces the airline’s quality of service plan for each passenger. She starts by boarding handicapped folks, then we move onto the airline’s diamond members, then gold, silver and finally we arrive at the bulk class. In this analogy the gate agent is the router and the passengers are the packets of data trying to get through to the WAN. The point is that for
-those diamond members to experience high quality the average Joes must wait. One more interesting lesson from this example is that if there is no one else waiting to board the plane when you show up it does not matter what your status is, you get to board next. The lesson here is that if the WAN is not+those diamond members to experience high quality the average Joes must wait. When people are waiting to board we call this the 'saturated' condition because the door cannot accommodate any more people per second. One interesting lesson from this example is that if there is no one else waiting to board the plane when you show up it does not matter what your status is, you get to board next. The lesson here is that if the WAN is not
 saturated your QoS setup will not matter much, all packets get immediately transmitted. saturated your QoS setup will not matter much, all packets get immediately transmitted.
  
Line 29: Line 30:
 Now a short word about connection tracking. When an application on your computer starts to communicate with another computer on the internet it is the normal course of events that the two computer exchange many packets back and forth. If you were to look at the header area of these packets you would see that they are nearly identical since the source, destination and type of packets are all the same. Your router calls this stream of packets a ‘connection’. The connection starts when the first packet is sent and ends when no more packets are being sent. To learn more about connection tracking I refer you to www.google.com. There is much written about this subject. Now a short word about connection tracking. When an application on your computer starts to communicate with another computer on the internet it is the normal course of events that the two computer exchange many packets back and forth. If you were to look at the header area of these packets you would see that they are nearly identical since the source, destination and type of packets are all the same. Your router calls this stream of packets a ‘connection’. The connection starts when the first packet is sent and ends when no more packets are being sent. To learn more about connection tracking I refer you to www.google.com. There is much written about this subject.
  
-Rules can be written to match on the contents of the packet headers, the number of bytes which have passed through the connection and the data that appears in the first few packets of the connection (called L7 pattern matching). Rule writing is the most frustrating part of QoS. There are only limited ways that we can classify data reliably and often we must compromise what we want to do because of it. You have to think about how to classify you traffic based on what the rules can do which probably is not exactly+Rules can be written to match on the contents of the packet headers, the number of bytes which have passed through the connection and the data that appears in the first few packets of the connection (called L7 pattern matching). Rule writing is the most frustrating part of QoS. There are only limited ways that we can classify data reliably and often we must compromise what we want to do because of it. You have to think about how to classify your traffic based on what the rules can do which probably is not exactly
 what you want but can be very close in many circumstances. what you want but can be very close in many circumstances.
 ===== QOS Example ===== ===== QOS Example =====
Line 211: Line 212:
 ==== Total Bandwidth Field ==== ==== Total Bandwidth Field ====
  
-Below the class table is the total (upload/download) bandwidth field. Proper setting of this fields is +Below the class table is the total (upload/download) bandwidth fields. Proper setting of these fields is important to making QoS function properly.  First determine the speeds your upload/download links can deliver.  One way to do this is by turning QoS off and using http://www.speakeasy.net/speedtest/ with no other computers or applications trying to use your WAN link.  Do it a couple of times and record separately the minimum upload and the minimum and maximum download speeds you obtain If you run it twice for example and once you get 1Mbps and the second time you get 2Mbps then your minimum is 1Mbps and your maximum is 2Mbps.
-critical to making QoS function properly. The value you enter here depends on if you are using the active +
-congestion controller or not and if your WAN connection type (set on the Connection->Basic) page is set +
-to PPPoEAssuming you are using the ACC set as follows:+
  
-When using PPPoE you should consult with your modem’s web page and enter the line speed the modem +Now start with the upload page entering 95% of the minimum upload speed you saw If the minimum changes in time then you may need to further lower your minimum.  This can be tedious but in my experience your upload speeds do not vary much so your first test will likely be sufficient.
-is running atEnter the uplink/downlink speeds on the corresponding QoS page.+
  
-When not using PPPoE you should enter your maximum download speed on the download screen and +On the download page the value you enter depends on if you are using ACC or not.  When using ACC you enter the maximum download speed you saw.  If you enter a value even 10% higher its OK too.  ACC is going to automatically adjust the actual speed QoS between 12% of this number and 100% of this number If you enter a number too high (say 2x your link speedthen you just lost some range because ACC will only adjust between 12% and 50(all the numbers between 50% and 100% are too high) but it will still basically work  
-95% of your measured upload speed on the upload screenThe way I recommend to measure your upload +
-speed is to first turn QoS off, then make sure no one is using the WAN link and then run a speed test such +
-as the one http://www.speakeasy.net/speedtest/ . Finally enter 95of the value you found with this test.+
  
-If you are not using the ACC then you will generally need to reduce your download bandwidth from the +If you are not using ACC then things get more complicated.  You need to enter the minimum value of your downlink speed Since downlink speeds can vary significantly in time, 20%-80% is not unusual, this can be an impossible task.  If the downlink speed is set too high your QoS will simply not work If set to low you will under utilize your link and feel cheated.  For this reason I recommend that you use the ACC if you want your QoS to work.
-values mentioned aboveThe amount to reduce varies from 20-80% depending on what it happening with +
-your ISP. For this reason I recommend that you use the ACC.+
  
 ===== Active Congestion Controller (ACC) ===== ===== Active Congestion Controller (ACC) =====
-The active congestion controller continuously monitors your WAN download performance and adjusts +For QoS to function your router needs to know the maximum rate of data that can pass through the WAN link.  You can experiment yourself with ACC off and see.  If you put too high of a number in your downlink speed field QoS breaks down and stops working If you put too low of a number you QoS works but your data rate is limited and you feel cheated.  So there is a perfect number.  If you can find that perfect number and it does not change ACC will not provide a benefit to you.  However for most users there is no perfect number because the amount speed your ISP provides varies in time This is where ACC can help you.
-the total downlink bandwidth in response to changes there. The amount of download bandwidth actually +
-delivered by your ISP will vary as conditions on their network change. Like you your ISP has a WAN +
-link to the internet. When their WAN link saturates they must limit the delivered performance to all their +
-customersThe ACC detects the performance being delivered by monitoring the round trip times (RTT) +
-of ping packets sent to your ISP’s gatewayThe RTT corresponds roughly to the amount of data that is +
-queued by the ISP and waiting to travel over the WAN link to your routerControlling the amount of +
-data that is queued is how the ACC makes QoS work.+
  
-Let’s think about the queue that your ISP has for you. The amount of data waiting in the queue will grow +The active congestion controller continuously monitors your WAN download performance and adjusts the total downlink bandwidth in response to changes By adjust I mean it will change the downlink speed QoS is using.  The values it will use are between the amount you entered as the peak downlink speed and the 1/8 of this value This is the dynamic range so to make the most of the available adjustment range it is important to enter the correct value of the peak download speed you can get and not more.  
-or shrink based on several factorsA critical point will be when it grows to the point that no more data +
-can fit in the queue. In that case the packet must be discarded by your ISP. This turns out to be bad for+
  
-QoSFor QoS to function accurately it alone must decide which packets should be dropped. When the +The amount of download bandwidth actually delivered by your ISP will vary as conditions on their network changeLike you your ISP has a WAN link to the internet. When their WAN link saturates they must limit the delivered performance to all their customers. The ACC detects the performance being delivered by monitoring the round trip times (RTT) of ping packets sent to your ISP’s gatewayThe RTT corresponds roughly to the amount of data that is 
-ACC is in active mode it is controlling the data flow such that this queue does not overflow and only your +queued by the ISP and waiting to travel over the WAN link to your routerControlling the amount of data that is queued is how the ACC makes QoS work.  The whole concept of ACC requires that when saturated the ping times increase This is commonly the case but if somehow this is not the case for your ISP connection then ACC cannot work and you should leave it off.
-router’s QoS is dropping packetsNotice I said that the ACC controls the length of downlink queue. It +
-cannot control the speed of your downlinkAs long as the queue in front of your WAN downlink has +
-enough data in it your downlink will be fully utilized. This is the goal of the ACC in active modeTo +
-keep you downlink fully utilized by allowing the queue to grow to the necessary length but not too long +
-that packets get dropped.+
  
-It turns out that the proper amount of data in your queue for full utilization would take about 100ms to +Let’s think about the queue that your ISP has for you. The amount of data waiting in the queue will grow or shrink based on several factors. A critical point will be when it grows to the point that no more data can fit in the queue. In that case the packet must be discarded by your ISP. This turns out to be bad for QoS. For QoS to function accurately it alone must decide which packets should be dropped. When the ACC is in active mode it is controlling the data flow such that this queue does not overflow and only your router’s QoS is dropping packets. Notice I said that the ACC controls the length of downlink queue. It cannot control the speed of your downlink. As long as the queue in front of your WAN downlink has enough data in it your downlink will be fully utilized. This is the goal of the ACC in active mode. To 
-drain away if no new packets arrived. This also means that each packet has to wait around 100ms in the +keep you downlink fully utilized by allowing the queue to grow to the necessary length but not too long that packets get dropped. 
-queue before it proceeds. The affects the round trip time (RTT) of a packet exchange. If for example I + 
-send a ‘ping’ message to a computer on the internet the response will have to wait in this queue. Adding +It turns out that the proper amount of data in your queue for full utilization would take about 100ms to drain away if no new packets arrived. This also means that each packet has to wait around 100ms in the queue before it proceeds. The affects the round trip time (RTT) of a packet exchange. If for example I send a ‘ping’ message to a computer on the internet the response will have to wait in this queue. Adding other overhead and you end up with a total RTT of around 150ms in this case. Some applications will be 
-other overhead and you end up with a total RTT of around 150ms in this case. Some applications will be +affected by an RTT of this length. So the ACC has another mode in which it reduces the average length of this queue to about half this value. This will lead to RTTs of around 75ms but at the cost of WAN utilization. When the minRTT mode is active WAN utilization drops by about 20% but the RTT is cut in 
-affected by an RTT of this length. So the ACC has another mode in which it reduces the average length +half. This is a useful compromise which the ACC will make when a class becomes active which indicates it needs minimum RTTs and is indicated in the status display by the MinRTT mode.
-of this queue to about half this value. This will lead to RTTs of around 75ms but at the cost of WAN +
-utilization. When the minRTT mode is active WAN utilization drops by about 20% but the RTT is cut in +
-half. This is a useful compromise which the ACC will make when a class becomes active which indicates +
-it needs minimum RTTs and is indicated in the status display by the MinRTT mode.+
  
 The ACC considers a class to be active if the bandwidth used by that class exceeds 4kbps. The ACC considers a class to be active if the bandwidth used by that class exceeds 4kbps.
Line 269: Line 243:
 Use non-standard ping target: The ACC needs to bounce pings off of a computer on the other side your Use non-standard ping target: The ACC needs to bounce pings off of a computer on the other side your
 WAN link in order to determine the amount of congestion which is present. By default the ACC uses WAN link in order to determine the amount of congestion which is present. By default the ACC uses
-the gateway assigned to the WAN port as this target, however, you can change this to another target if +the gateway assigned to the WAN port as this target, however, this is often not the appropriate target and must be changed.  Unfortunately I am not sure how to robustly determine a good ping target for all cases so you will have to pay attention to this setting.  If your ACC is not working this is the first thing to play with Remember that the ACC controls the congestion between your router and this target so you need to pick something on the ISP side of your WAN connection.  One target that I often use for experimentation is the OpenDNS server 208.67.222.222 so if the default is not working then try that one next.  The optimum target to use will be one between your router and this server.  You can use traceroute (Google it) to examine all the routers your traffic went through to get to OpenDNS.  Then looking at the times listed in its output pick the one with the first significant time increase or play with several until you find the closest one to your router that works with ACC.
-needed. Remember that the ACC controls the congestion between your router and this target so you need +
-to pick something on the ISP side of your WAN connection.+
  
 Use custom ping limit: This is the ping limit that ACC will use in MINRTT mode. Unless you check Use custom ping limit: This is the ping limit that ACC will use in MINRTT mode. Unless you check
Line 278: Line 250:
 own this setting can be used to remedy the problem. This value will normally be between 40-90ms and own this setting can be used to remedy the problem. This value will normally be between 40-90ms and
 can be observed when the ACC is in MINRTT mode as the ping time limit. can be observed when the ACC is in MINRTT mode as the ping time limit.
 +
 +===== Router Performance =====
 +
 +Your router has a CPU and that CPU has a limit on how much data is can process per second.  Almost nothing written on this page will be true if you are trying to exceed the limitations of your router.  Quoting Clint Eastwood "A man needs to know his limitations" so know your router's limitations.  When you are exceeding your throughput limitation you will see "CPU Load Averages" on the Status screen approach 1.0 and strange unexplained things happening. 
 +
 +This will happen somewhere between 10Mbps and 500Mbps depending on your router and what Gargoyle features you are using.  To use Gargoyle you must reduce the download/upload link speeds on your QoS pages so that your CPU never gets near the 1.0 limit even under fully saturated conditions.
 +
 +Bandwidth monitoring and QoS are the two features that take the most processing for your router.  If you turn them off you will get more through put but of course you will lose many of the reasons you are trying to use Gargoyle.
 +
 +Don't complain on the forum that your router's native firmware gives you better throughput than Gargoyle firmware does.  With Gargoyle you are getting features and stability which you do not have with your native firmware.  If you cannot achieve the speeds you want get a faster router.
 +
 +----------------
 +
 +All routers have a maximum processing speed for the WAN link. If you lower your total WAN bandwidth (upload plus download) to below this maximum on the Gargoyle QoS screens then Gargoyle will throttle your throughput and all your Gargoyle functions will work properly. This may result in you not being able to utilize the full bandwidth your ISP provides you but you will have stable and predictable performance. 
 +
 +Selecting a router that has enough horsepower to handle your full bandwidth is important if you really want to use all your available bandwidth. Stock firmware which comes with your modem will usually provide higher throughput than Gargoyle. The reason for this is simple. The stock firmware does not have the advanced features of Gargoyle. Especially QoS and Bandwidth monitoring. These are the features that require CPU horsepower. If you turn them off in Gargoyle you will also see a high throughput capability.
 +
 +Like a car top-end speed is not the only desirable feature. The many other features that you use everyday are usually what you should concentrate on and these are what Gargoyle provides.
  
 ===== FAQS ===== ===== FAQS =====
Line 290: Line 280:
 the split becomes 15/(15+35)=30% and 35/(35+15)= 70% the split becomes 15/(15+35)=30% and 35/(35+15)= 70%
  
-==== how is the class bandwidth shared ====+==== What is per IP sharing? ====
  
 **Q.** If I have data from several computers directed into the same class how is the class bandwidth **Q.** If I have data from several computers directed into the same class how is the class bandwidth
 shared between them. shared between them.
  
-**A.** Prior to Gargoyle v1.5.4 there was no control on this and the sharing could not be predicted. +**A.** Prior to Gargoyle v1.5.4 there was no control on this and the sharing could not be predicted.  Starting with v1.5.4 Gargoyle shares bandwidth equally between different IP addresses directed to the same class. This makes QoS setups for large LANs much easier. For example if merely want all computers on your network to have the same bandwidth you need to only create a default class, delete all your rules and enable QoS.  Per IP sharing within a class requires no configuration and cannot be turned off.  If you want a particular IP to be treated special you need to make exclusive classes for it and rules to match.
-Starting with v1.5.4 Gargoyle shares bandwidth equally between different IP addresses directed to +
-the same class. This makes QoS setups for large LANs much easier. For example if merely want all +
-computers on your network to have the same bandwidth you need to only create a default class, delete all +
-your rules and enable QoS.+
  
 ==== enable minimize RTT ==== ==== enable minimize RTT ====
Line 322: Line 308:
  
 **B.** The MAC address of the devices on your LAN are not available to QoS. In the Linux routing **B.** The MAC address of the devices on your LAN are not available to QoS. In the Linux routing
-architecture this information is stripped from the packets before they get to the code executing QoS. +architecture this information is stripped from the packets before they get to the code executing QoS.  You can approximate the behavior you want by assigning a fixed IP address to the device with the MAC in question.  Then you can write rules against this IP address.
 ==== QoS for traffic between computers ==== ==== QoS for traffic between computers ====
  
Line 329: Line 314:
 **Q.** I want to use QoS for traffic between computers on my LAN. How can I do that? **Q.** I want to use QoS for traffic between computers on my LAN. How can I do that?
  
-**A.**  The short answer is that you cannot do this. In most routers LAN<->LAN traffic is handled by +**A.**  The short answer is that you cannot do this, QoS only operates on traffic between your router and ISP (the WAN link). In most routers LAN<->LAN traffic is handled by a switch in hardware and therefore never seen by your router software. This is also why LAN<->LAN traffic can have much higher bandwidth than LAN<->WAN traffic. Since QoS never sees traffic there is 
-a switch in hardware and therefore never seen by your router software. This is also why LAN<->LAN +nothing that it can do. This applies to all Wifi traffic as well.  QoS can do nothing to help when the congestion which is caused by an overloaded radio link.  I advise serious gamers to use a hardwired connection between their console/PC and the router so they will not be affected by unpredictable traffic jams on the radio link.
-traffic can have much higher bandwidth than LAN<->WAN traffic. Since QoS never sees traffic there is +
-nothing that it can do.+
  
 ==== Number of rules and classes ==== ==== Number of rules and classes ====
Line 347: Line 330:
  
 **A.** In Gargoyle we use the concept of bandwidth to allocate the WAN resource and not the concept of ‘priority’.  One reason is the the word 'priority' is ambiguous in meaning.  It could mean that Priority packets always get transmitted before the lower priority classes.  You can achieve this behavior in Gargoyle by setting the minimum bandwidth of the priority class equal to your link speed and setting the minimum bandwidth of all other classes to zero.  In the real world you will find that that Gargoyle's %BW, minBW and maxBW concepts are more flexible so I encourage you to think of your problem in these terms and abandon the concept of 'Priority'. **A.** In Gargoyle we use the concept of bandwidth to allocate the WAN resource and not the concept of ‘priority’.  One reason is the the word 'priority' is ambiguous in meaning.  It could mean that Priority packets always get transmitted before the lower priority classes.  You can achieve this behavior in Gargoyle by setting the minimum bandwidth of the priority class equal to your link speed and setting the minimum bandwidth of all other classes to zero.  In the real world you will find that that Gargoyle's %BW, minBW and maxBW concepts are more flexible so I encourage you to think of your problem in these terms and abandon the concept of 'Priority'.
 +
 +
 +==== QoS not working ====
 +
 +
 +**Q.** QoS is not working what could be wrong.
 +
 +**A.** As you can tell by the length of this article QoS is a complicated subject and there are many things that could be wrong.  But the basics you should check are first if the connections are being classified correctly by your rules, then is my router's CPU being overloaded.  Check these with ACC off and your link speeds set to 50% of what you think your actual speeds are.  If things are working there at least your rules and classes are correct.  Move on to high speeds and using the ACC.
 +
 +==== ACC keeps lowering my link limit ====
 +
 +
 +**Q.** Why does ACC keep lowering my link limit, I have to reset to get it back.
 +
 +**A.** ACC lowers your link limit until the filtered ping time falls under the target ping times.  So if your link limits is being lowered either your ISP performance has dropped (the usual case) or your target ping time is too aggressive.  
 +
  
 ===== Common Myths ===== ===== Common Myths =====
Line 404: Line 403:
 Example:  On a 10Mbps down/1Mbps up link we want HTTP traffic to consume 50% of the WAN down link when saturated.  Let’s say our HTTP traffic is routed into the Normal class on both upload and download.  The %BW in the download Normal class is simply 50%.  On the uplink we must account for the fact that the link is asymmetrical so we allocate 3.6% * 10Mbps/1Mbps = 36% to the Normal class in the uplink.  With this setup if either the uplink or downlink is saturated the HTTP traffic will be allocated not less than 5Mbps in the downlink. Example:  On a 10Mbps down/1Mbps up link we want HTTP traffic to consume 50% of the WAN down link when saturated.  Let’s say our HTTP traffic is routed into the Normal class on both upload and download.  The %BW in the download Normal class is simply 50%.  On the uplink we must account for the fact that the link is asymmetrical so we allocate 3.6% * 10Mbps/1Mbps = 36% to the Normal class in the uplink.  With this setup if either the uplink or downlink is saturated the HTTP traffic will be allocated not less than 5Mbps in the downlink.
  
 +==== Whenever I use QoS my ping times increase ====
  
 +**
 +Statement:** I don't use QoS because it makes my ping times increase and I lose games online.  I need really good ping times to be competitive.
  
 +**Rebuttal:**  Ah, QoS is not responsible for the beat down you just received.  If your WAN link is not saturated then packets will be delayed not more than 1 ms on their way through your router.  If your link gets saturated and your rules are not written correctly you can get delays that can approach 150ms.  Check your rules to make sure your gaming traffic is going to the class you intend and that the class is not getting overloaded.
  
  
Line 461: Line 464:
  
  
-  
  
 +
 + 
qos.1351457592.txt.gz · Last modified: 2012/10/28 20:53 by pbix