QoS enhancement idea

Suggest improvements and new features for Gargoyle.

Moderator: Moderators

oviano
Posts: 26
Joined: Sun Dec 20, 2015 7:41 am

QoS enhancement idea

Post by oviano »

I like Gargoyle's QoS implementation - the ACC certainly takes things on a step compared to the other implementations I've experienced (DD-WRT and Tomato). So well done for that enhancement.

However, it still suffers, as the others do, from a flaw that I have yet to find a way to work around.

My main requirement for QoS is so that when I am watching IPTV (a remote Slingbox stream, to be precise) I want to allocate a minimum bandwidth for this and not have other downloads encroach on this.

This is easy to setup in Gargoyle; I just took the default QoS settings, ditched VoIP as I don't use it and added a new IPTV class with the minimum bandwidth it requires (3mbps) and split the percentage bandwidths 75:19:5:1 (IPTV:Fast:Normal:Slow). To give context, my maximum download speed on my 8mbps line is 6,900kbps, so with ACC enabled I have entered 6,900 as the figure in download QoS.

The problem I encounter though is that it often doesn't react quickly enough; if another device, or devices suddenly start accessing things on the Internet, then the system doesn't peg them back quickly enough to avoid interrupting my IPTV stream. This may be, in-part, because a Slingbox stream typically only buffers around 5s so it's probably more prone to fluctuations in the available bandwidth.

However I have found that if I enforce a conservative maximum bandwidth in the non-IPTV classes (say 2mbps in total) then the QoS system does a much better job of keeping things under control and I don't get as many interruptions to my stream. I assume this is because it kicks in quicker in order to limit the bandwidth to 2mbps, before it's had a chance to mess up my IPTV stream.

So the effect I want is that when my IPTV class is active (transferring > some threshold kbps) then it should enforce this 2mbps limit for the other classes. When I stop the IPTV then this limit should no longer apply.

Another way of looking at it might be to have an option for the "Minimum Bandwidth" for a class to be *reserved* even when it's not being used (but the class is active > the threshold kbps). That way I would just put in a higher-than-required figure for my IPTV (4-5mbps, say) which would then have the same effect of limiting the other classes to whatever is left of my overall bandwidth.

Essentially I want a far stricter mechanism for throttling my non-IPTV classes when the IPTV is being used, because the current system simply doesn't work well in my use-case.

oviano
Posts: 26
Joined: Sun Dec 20, 2015 7:41 am

Re: QoS enhancement idea

Post by oviano »

So I managed to hack something together which works but I could do with something slightly more elegant.

I wrote a bash script that checks the timestamp of a file and if the timestamp is more than 60s ago then it will disable the 2000 max bandwidth for my default (non-IPTV) QoS class. If the timestamp is more recent it will enabled the 2000 max bandwidth.

This script runs as a cron task every minute:

Code: Select all

!/bin/sh                                                                                    
cd /etc                                                                                      
thecurrenttime=`date +%s`                                                                    
slingfronttime=`date -r slingfront +%s`                                                      
cd config                                                                                    
max_bandwidth=`uci get qos_gargoyle.dclass_1.max_bandwidth -q`                               
if [ "$?" = "1" ]                                                                            
then                                                                                         
  max_bandwidth=0                                                                            
fi                                                                                           
if [ "$thecurrenttime" -gt "$((slingfronttime+60))" ]                                        
then                                                                                         
  if [ $max_bandwidth -eq 2000 ]                                                             
  then                                                                                       
    uci delete qos_gargoyle.dclass_1.max_bandwidth                                           
    uci commit qos_gargoyle                                                                  
    /etc/init.d/qos_gargoyle restart                                                         
  fi                                                                                         
else                                                                                         
  if [ $max_bandwidth -ne 2000 ]                                                             
  then                                                                                       
    uci set qos_gargoyle.dclass_1.max_bandwidth=2000                                         
    uci commit qos_gargoyle                                                                  
    /etc/init.d/qos_gargoyle restart                                                         
  fi                                                                                         
fi                                                                                           
exit 0 
I placed the script in /etc and added this line to the cron jobs by typing "crontab -e":

Code: Select all

* * * * * /etc/qos_iptv_chk
Then on the PCs in my house that stream from my Slingbox I have modified the viewing app (SlingFront, a thirdparty VB application) to ssh into the router every 10s and simply touch the test file when the app is streaming. For this I installed PuTTY and made the app execute a plink.exe command:

Code: Select all

plink.exe -ssh root@192.168.1.1 pw XXXXXXXXX touch /etc/slingfront
It works but really I'd prefer this all to be self-contained in the router - ideally my cron script would be able to detect directly whether the IPTV class is active but I couldn't work out how to do that. At the moment it obviously only works when I use the customised streaming app on the PCs - however occasionally I view using the iOS Slingplayer app and I don't have the luxury of being able to modify that to touch the file on the router.

So does anyone know how I can retrieve the current (or short-term averaged) load of a specific class inside an ssh script? Or whether a particular class is considered "active" (which I think I read somewhere equates to a load of 4kbps)?

This might then become a useful template for others wanting to do something similar. At the moment it's pretty specific to my requirements!

MucuCat
Posts: 49
Joined: Fri Nov 20, 2015 7:28 am

Re: QoS enhancement idea

Post by MucuCat »

Do not use ACC if you have only 7000mbps available. i do not know why but when ACC is enabled it will lower your available download all the time. for example i have 25 000mbps and if i enable ACC and run speedtest 8x in a row, my max download speed becomes 8000kbps. everytime my bandwidth is under huge load, my max download speed would drop and not come back. if i disable ACC everything works as it should.

and if you set a minimum bandwidth to your IPTV class, how can other devices even access it? what would be the point of minimum bandwidth allocation if others can access it? i think that there is a treshold when in your example IPTV class becomes active, only then your 3mbps gets alocated.

i am not sure, i just want to help. i am also interested in this since i play online games and i need the best speed possible. :)

Lantis
Moderator
Posts: 6753
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: QoS enhancement idea

Post by Lantis »

This is expected behaviour from ACC when performing a speed test.

You are saturating your connection, and it is trying to keep ping reasonable.

If you had a long enough download occurring where you ping didn't need to be managed, your ACC will allow the speed to rise as demand requires it.

The system works.
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

oviano
Posts: 26
Joined: Sun Dec 20, 2015 7:41 am

Re: QoS enhancement idea

Post by oviano »

MucuCat wrote:Do not use ACC if you have only 7000mbps available. i do not know why but when ACC is enabled it will lower your available download all the time. for example i have 25 000mbps and if i enable ACC and run speedtest 8x in a row, my max download speed becomes 8000kbps. everytime my bandwidth is under huge load, my max download speed would drop and not come back. if i disable ACC everything works as it should.

and if you set a minimum bandwidth to your IPTV class, how can other devices even access it? what would be the point of minimum bandwidth allocation if others can access it? i think that there is a treshold when in your example IPTV class becomes active, only then your 3mbps gets alocated.

i am not sure, i just want to help. i am also interested in this since i play online games and i need the best speed possible. :)
Hey thanks for your comments. Regarding ACC - I don't see the same effect when I have ACC enabled. For me ACC works pretty well - when the ping to ISP gateway goes up it lowers the speed. This only happens, for me, at certain times when the ISP is under pressure. At all other times I pretty much get the full 7mbps. I guess it works for some people better than others.

As for the minimum bandwidth - you are right, that's how it *ought* to work, but I've yet to find any implementation of QoS that is that responsive in practice.

This makes sense if you consider roughly how QoS works for downloads - if a PC connects to a server somewhere and demands some data then the remote server is going to try and deliver it as quickly as the infrastructure will allow. My understanding is that the only thing QoS on your router can do to slow it down is to throw away some of this data so that the amount QoS "forwards on" to the PC fits within the limit. But initially at least it's still receiving the data as fast as possible and saturated your line to your ISP. The idea is that the remote server will not be getting the "acks" (acknowledgement packets) for the data that has been lost and so will stop sending data so fast. In the case of the PC viewing say Netflix or something then this would take the form of switching to a lower quality that uses less bandwidth.

What I find is that this scaling back of the rate the remote server sends data isn't always instant so there is at least a period of time when the line is saturated.

So my idea was that if I could impose an overly harsh limit on the non-IPTV classes, i.e. more than is needed if QoS worked perfectly, then the scaling back of the rate the remote server is sending data would begin sooner - hopefully before its had a chance to affect my IPTV stream.

I think it has improved things for me, though I need to test it for longer - it makes browsing and doing stuff on other PCs etc in the house noticeably more sluggish when I'm watching IPTV but to be honest I'd rather that than what was happening before which was I'd be watching the football and then my my wife or daughter would start watching some videos or whatever and it would temporarily suck up as much bandwidth as it could before QoS would kick in and settle things down. By that time though my stream has already been interrupted and it's trying to re-buffer and jumping and skipping and all that......

Lantis
Moderator
Posts: 6753
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: QoS enhancement idea

Post by Lantis »

You have an excellent understanding of QOS. :)
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

MucuCat
Posts: 49
Joined: Fri Nov 20, 2015 7:28 am

Re: QoS enhancement idea

Post by MucuCat »

Lantis wrote:This is expected behaviour from ACC when performing a speed test.

You are saturating your connection, and it is trying to keep ping reasonable.

If you had a long enough download occurring where you ping didn't need to be managed, your ACC will allow the speed to rise as demand requires it.

The system works.
so for example i play games and 2 other people on my network watch 1080p youtube video. the connection gets saturated and ACC lowers the availble download connection from 25000 to lets say 10000. wouldnt now all people on the network hav issues since there is not nearly enoug bandwidth?

i am sorry for asking so manny questins. would like to understand how things work :idea:

Lantis
Moderator
Posts: 6753
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: QoS enhancement idea

Post by Lantis »

your QoS rules need to compliment the ACC system

If you prioritise your gaming traffic to have low ping and have a minimum bandwidth required for gaming then that user will see no effect.

The two 1080p streamers will have reduced bandwidth necessary for the gamer to experience minimal lag.


SOMEONE has to LOSE in this system. You can make it as fair as possible by only reserving the minimum amount of bandwidth necessary.
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

MucuCat
Posts: 49
Joined: Fri Nov 20, 2015 7:28 am

Re: QoS enhancement idea

Post by MucuCat »

thank you for the explanation. :)

gargoyle is the best router software i tryed for gaming. i had tomato by shibby and stock on 3 different routers and i always faced issues while gaming.

nworbnhoj
Posts: 916
Joined: Mon Jul 21, 2014 10:08 am
Location: Australia
Contact:

Re: QoS enhancement idea

Post by nworbnhoj »

MucuCat wrote:gargoyle is the best router software i tryed for gaming.
It would be great if more gamers knew about Gargoyle!

More wins in game and less fights in household :-)
Can you help someone else get Gargoyle up and running?
TL-WDR3600 : Gargoyle 1.9.0 : NBN FixedWireless
TL-WR1043ND-V2 : Gargoyle 1.8.0 : 3G Huawei E160E

Post Reply