Community discussions

MikroTik App
 
bergerb
just joined
Topic Author
Posts: 4
Joined: Mon Mar 23, 2020 10:01 am

Dynamic PCQ / Queue for varying bandwidth

Sat Jan 09, 2021 11:16 pm

Hello,

I am currently trying to setup PCQ for our home.
It seems to be working fine, when the bandwidth is actually what it should be.

Unfortunately our bandwidth varies from about 80Mbit/s to 15Mbit/s.
Is there a way to dynamically adjust PCQ for that? Or is there a queue type, that is better suited for our scenario?

When the network is empty, I get a ping of around 30.
When someone starts a download and I adjust the max-limit to a lower value that fits the current download speed, I get a ping of around 100, but also timeouts.

Below is my current configuration.
/ip firewall mangle
add action=mark-packet chain=postrouting comment="ALL UP" new-packet-mark=\
    CLIENT_UPLOAD out-interface-list=WAN passthrough=yes
add action=mark-packet chain=prerouting comment="ALL DOWN" in-interface-list=\
    WAN new-packet-mark=CLIENT_DOWNLOAD passthrough=yes
add action=mark-packet chain=forward comment="ALL UP" new-packet-mark=\
    CLIENT_UPLOAD out-interface-list=WAN passthrough=yes
add action=mark-packet chain=forward comment="ALL DOWN" in-interface=ether1 \
    new-packet-mark=CLIENT_DOWNLOAD passthrough=yes
add action=log chain=forward disabled=yes packet-mark=no-mark

/queue type
add kind=pcq name=PCQ_DOWNLOAD pcq-classifier=dst-address \
    pcq-dst-address-mask=0 pcq-dst-address6-mask=64 pcq-src-address-mask=0 \
    pcq-src-address6-mask=64
add kind=pcq name=PCQ_UPLOAD pcq-classifier=src-address pcq-dst-address-mask=\
    0 pcq-dst-address6-mask=64 pcq-src-address-mask=0 pcq-src-address6-mask=\
    64
    
/queue tree
add limit-at=1M max-limit=5M name="queue1 PCQ_DOWNLOAD" packet-mark=\
    CLIENT_DOWNLOAD parent=global queue=PCQ_DOWNLOAD
add max-limit=19M name="queue2 PCQ_UPLOAD" packet-mark=CLIENT_UPLOAD parent=\
    global queue=PCQ_UPLOAD
I hope someone could point me to the right direction.

Thanks
bergerb
 
bergerb
just joined
Topic Author
Posts: 4
Joined: Mon Mar 23, 2020 10:01 am

Re: Dynamic PCQ / Queue for varying bandwidth

Sun Jan 10, 2021 11:36 am

Alright, small update:

My Queue Type was not set up correctly.

Found that out by setting the pcq-rate to 10Mbit/s and 10Mbit/s was the max I got.

Image

Problem was, that the src and dst mask was not set correctly in the queue type. It was set to 0 instead of 32.
So PCQ couldn't distinguish between IPs because they were all in the same "subnet"
/queue type
add kind=pcq name=PCQ_DOWNLOAD pcq-classifier=dst-address pcq-rate=10M
add kind=pcq name=PCQ_UPLOAD pcq-classifier=src-address
Now looks somewhat expected:
Image

But that doesn't solve our varying bandwidth problem.. :)
I mean it kinda does, but it limits the bandwidth drastically..
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11598
Joined: Thu Mar 03, 2016 10:23 pm

Re: Dynamic PCQ / Queue for varying bandwidth

Sun Jan 10, 2021 1:05 pm

PCQ can't work correctly if it doesn't know what is the limit. In theory it could learn about the limit by observing various transfer properties (achieved throughput, RTT of TCP packets, etc.), but it would be quite unreliable because transfer properties are affected by every single path part for every single connection, not only the last mile (which is indeed bottleneck most of the time). PCQ can quite reliably throttle Tx (uplink in usual case) because it observes Tx queues and can work with QoS parameters. Throttling Rx is quite challenging even if throughput is static, with ever changing downlink capacity this task is nearly impossible.
 
User avatar
Ishtiaque
Frequent Visitor
Frequent Visitor
Posts: 54
Joined: Sat Jul 30, 2016 5:17 pm
Location: Bangladesh
Contact:

Re: Dynamic PCQ / Queue for varying bandwidth

Thu May 12, 2022 7:08 am

/queue type
add kind=pcq name=PCQ_DOWNLOAD pcq-classifier=dst-address \
pcq-dst-address-mask=0 pcq-dst-address6-mask=64 pcq-src-address-mask=0 \
pcq-src-address6-mask=64
add kind=pcq name=PCQ_UPLOAD pcq-classifier=src-address pcq-dst-address-mask=\
0
pcq-dst-address6-mask=64 pcq-src-address-mask=0 pcq-src-address6-mask=\
64

/queue tree
add limit-at=1M max-limit=5M name="queue1 PCQ_DOWNLOAD" packet-mark=\
CLIENT_DOWNLOAD parent=global queue=PCQ_DOWNLOAD
add max-limit=19M name="queue2 PCQ_UPLOAD" packet-mark=CLIENT_UPLOAD parent=\
global queue=PCQ_UPLOAD


Dear Replace all zeros by 32 .. then post your comment ...
I Think it will solve your problems cause pcq din't getting IPV4 maskings
 
User avatar
Ishtiaque
Frequent Visitor
Frequent Visitor
Posts: 54
Joined: Sat Jul 30, 2016 5:17 pm
Location: Bangladesh
Contact:

Re: Dynamic PCQ / Queue for varying bandwidth

Thu May 12, 2022 7:13 am

PCQ can't work correctly if it doesn't know what is the limit. In theory it could learn about the limit by observing various transfer properties (achieved throughput, RTT of TCP packets, etc.), but it would be quite unreliable because transfer properties are affected by every single path part for every single connection, not only the last mile (which is indeed bottleneck most of the time). PCQ can quite reliably throttle Tx (uplink in usual case) because it observes Tx queues and can work with QoS parameters. Throttling Rx is quite challenging even if throughput is static, with ever changing downlink capacity this task is nearly impossible.
It's A great Part Of this solution ...

Who is online

Users browsing this forum: No registered users and 71 guests