SQM cake: traffic prioritisation

Remind me again, you are running the torrents on a separate machine from the rest of your sensitive applications like ZOOM?

That's correct. I see the ping spikes coming in when torrenting which uses lots of connections.

have you enabled "nat dual-dsthost" on download direction?

I did yup, sadly it made no difference.

I see it with SQM on or off, a consistent increase in ping times when torrenting, I can limit the torrent speed to be incredibly low and still see it. It must be something to do with the connections the torrent client is using.

cake prioritizes sparse flows, perhaps the torrent just keeps opening and closing lots of connections that transfer briefly?

Do you have more than 1 LAN? (ie. VLANs) and do you have a wired or wifi integrated router?

I'm using an X86 system as my router and I have an external access point for Wi-Fi. Not using any VLANs, just the LAN that is setup by default with OpenWrt.

Try putting two instances of SQM... One on WAN with "upload" only, and one on the LAN with "upload" only having the value of your internet download speed.

Run diffserv4 on both. Then add two iptables rules, one to zero out DSCP on all packets, and one to tag UDP on the port your torrent client uses as CS1. This will force your torrents into the "bulk" tin and should reduce their interruption on your other traffic.

Thanks, I will give that a go shortly.

So am I to assume the ping spikes due to the large number of connections is simply not fixable?

I think the heuristic of prioritizing sparse connections is working against you. To fix this you need to tell SQM that these are low priority streams. hence tagging DSCP CS1 on them. I think that should fix it.

Also I think torrents can sometimes use TCP as well? Might as well tag both TCP and UDP based on the port you use.

1 Like

That is rarely the case, at least not with torrents, where the flows actually try to transmit some data...

Yes, what system are you using on the torrent machine?

I've seen torrents where I get a connection, it transmits one or a small number of "chunks" and then closes. I'm not sure how big the chunks are, but it could easily be confused as sparse if a chunk is like 10 or 100k bytes, particularly if you're getting 100 of these connections a minute or something. that was my main thought, some kind of "new connection" boost because it's classified as sparse initially? I'm not sure if that's true in cake.

It's just a Windows 10 system using qBittorrent.

Well, the thing about the sparse boost is that it needs to effectiv

Ah, that indicates that at least egress DSCP marking should not be that hard:
Here are my notes of how to use Windows on-board tools to selectively mark packets by application (in this example I used putty.exe, you would need to replace that with the binary name of the torrent application):

# windows QoS: https://docs.microsoft.com/en-us/powershell/module/netqos/?view=win10-ps
Get-NetQosPolicy
# temporary -PolicyStore ActiveStore, otherwise omit -PolicyStore
New-NetQosPolicy -Name "putty" -AppPathNameMatchCondition "putty.exe" -ThrottleRateActionBitsPerSecond 1MB -PolicyStore ActiveStore -NetworkProfile All -DSCPAction 47 -WhatIf


New-NetQosPolicy -Name "putty" -AppPathNameMatchCondition "putty.exe" -PolicyStore ActiveStore -NetworkProfile All -DSCPAction 46

Get-NetQosPolicy -Store ActiveStore

Name           : putty_ps
Owner          : PowerShell / WMI
NetworkProfile : All
Precedence     : 127
AppPathName    : putty.exe
JobObject      :
DSCPValue      : 46

Remove-NetQosPolicy -Name "putty_ps" -PolicyStore ActiveStore

Seems to work, and I confirmed via tcpdump that putty's ssh packet originating from the windows VM host actually used DSCP 46 (aka EF). I note that powershell needs to be run as administrator, and the policies do not end up visible in Local Group Policy Editor. "-PolicyStore ActiveStore" will not survive a reboot, but for novice users that might be nice so a reboot cleans the slate in good windows tradition. I assume that after initial testing one could omit the "-PolicyStore ActiveStore" directive and store tested configs more permanently.

Obviously the goal for the torrent App should not be 46/EF, but 8/CS1 so that layer_cake.qos will put this in the lowest priority tin. Also this will only affect your upstream which unfortunately might not be your bottleneck.

Question: the bittorrent machine is connected via ethernet to the router and not sharing the same wifi channel as the chromecast for gaming?

@moeller0 Sorry, Chromecast? You've lost me.

The BitTorrent machine is indeed connected via ethernet to the router.

I can see the ping spikes just pinging say 8.8.8.8 from the router directly.

I am almost sure it's ingress as I cap the BitTorrent client's upload to 200KB/s.

Oops, I am mixing up different threads, again. Sorry....

Okay that is good.

Which is also the direction harder to shape, since we can only shape after the fact and if the individual torrent flows are not responsive enough, their "backspill" will fill up the over-sized and under-managed buffer at the ISP side of your link, and then there is little SQM can do. Are you using ĀµTP or TCP for your torrents?

hi,

newbee question, If I have amny clients (15) with only 60/10mbps, and my son plays all the time on his new Playstation 5, and his P5 is lagging. So do I have to use SQM or QoS?

thanks

Start with SQM. Read the wiki article on SQM it's quite comprehensive and then feel free to open a new topic if you have trouble

1 Like

So SQM with the per-internal-IP fairness configuration will leave
(60/10) : 15 => 4/0.6 of bandwidth for the PS5, worst case, with hopefully more. That does not look like the upload is guaranteed to be enough to not cause issues, but it should be better than the current lack of any guarantee.
As @dlakelan indicated. if the default SQM performance leaves something to be desired, there are ways to try to improve, but all relatively complex. In short, it seems like a decent idea to test whether SQM might not be already good enough....

1 Like

hi eveybody i' m use now

diffserv4 with layer cake and put dscp cs7 for latency sensitive

and streaming video for af41 liike this

iptables -t mangle -A 
 ##CALL OF DUTY 
iptables -t mangle -A POSTROUTING -p udp --dst 192.168.2.160 -j DSCP --sport 30000:45000 --dport 3074 --set-dscp-class CS7 -m comment --comment "Dopam-IT_1987-UDP-1"

iptables -t mangle -A POSTROUTING -p udp --src 192.168.2.160 -j DSCP --sport 3074 --dport 30000:45000 --set-dscp-class CS7 -m comment --comment "Dopam-IT_1987-UD
config queue 'eth1'
	option qdisc 'cake'
	option enabled '1'
	option interface 'wan'
	option download '56000'
	option upload '16000'
	option debug_logging '0'
	option verbosity '5'
	option linklayer 'ethernet'
	option overhead '44'
	option script 'layer_cake.qos'
	option qdisc_advanced '1'
	option squash_dscp '1'
	option squash_ingress '1'
	option ingress_ecn 'ECN'
	option egress_ecn 'NOECN'
	option qdisc_really_really_advanced '1'
	option eqdisc_opts 'diffserv4'

i'm use cs7 because is high priority in latecny sensitvie

static int cake_config_diffserv4(struct Qdisc sch)
{
/
Further pruned list of traffic classes for four-class system:
*

  •  Latency Sensitive  (CS7, CS6, EF, VA, CS5, CS4)
    
  •  Streaming Media    (AF4x, AF3x, CS3, AF2x, TOS4, CS2, TOS1)
    
  •  Best Effort        (CS0, AF1x, TOS2, and those not specified)
    
  •  Background Traffic (CS1)
    
  •  Total 4 traffic classes.
    

for the moment my game is good ^^