Community discussions

 
asderferjerkel
just joined
Topic Author
Posts: 3
Joined: Fri Nov 20, 2015 3:08 pm

PCQ not dividing bandwidth evenly

Fri Nov 20, 2015 3:35 pm

Hi,

I'm trying to set up PCQ to divide available bandwidth equally between a number of clients. I'm applying the queue to my pppoe-client interface so that only WAN traffic will be queued, and LAN traffic won't. I've set it up as follows:
/queue simple
add comment="WorkingHours queue" max-limit=670k/670k name=Internet queue=\
    pcq-download-default/pcq-upload-default target=pppoe-west
Since it's applied to a WAN port, download and upload are reversed, so the download queue has the type pcq-upload-default, and the upload queue has the type pcq-download-default.

It works in that the overall bandwidth of the connection is limited to 670kbps up and down, but that bandwidth isn't being evenly shared between clients - which is what I thought PCQ was supposed to achieve. An example:

Image

The green and purple are two test clients trying to download a large file simultaneously - but as you can see it's not consistent, and every client sees a different speed. Any ideas what I might be doing wrong?

I had also previously tried marking packets to and from the internet based on src and dst address:
/ip firewall mangle
add chain=postrouting action=mark-packet new-packet-mark=Internet_upload passthrough=no dst-address=!192.168.2.0/23 log=no log-prefix=""
add chain=prerouting action=mark-packet new-packet-mark=Internet_download passthrough=no src-address=!192.168.2.0/23 log=no log-prefix=""
And also tried marking based on interface:
/ip firewall mangle
add action=mark-packet chain=postrouting comment=\
    "Traffic destined for internet (to apply QoS)" disabled=yes \
    new-packet-mark=Internet_upload out-interface=pppoe-west passthrough=no
add action=mark-packet chain=prerouting comment=\
    "Traffic coming from internet (to apply QoS)" disabled=yes in-interface=\
    pppoe-west new-packet-mark=Internet_download passthrough=no
Then applying the queue based on the packet marks:
/queue simple
add comment="Upload queue"max-limit=670k/0 name=Upload \
    packet-marks=Internet_upload queue=\
    pcq-upload-default/pcq-download-default target=192.168.2.0/23 total-queue=pcq-upload-default
add comment="Download queue" max-limit=0/670k name=Download \
    packet-marks=Internet_download queue=\
    pcq-upload-default/pcq-download-default target=192.168.2.0/23 total-queue=pcq-download-default
...but the effect was much the same. Any help would be very much appreciated!
 
User avatar
chechito
Forum Guru
Forum Guru
Posts: 1743
Joined: Sun Aug 24, 2014 3:14 am
Location: Bogota Colombia
Contact:

Re: PCQ not dividing bandwidth evenly

Fri Nov 20, 2015 5:44 pm

1. take in count your real wan available bandwidth for queuing to work perfectly you have to use only 80-90% of real bandwidth as total queue

2. you have to queue all the traffic incoming and outgoing to internet without leaks

3. try with a simpler configuration, i think that configa can be done with only one simple queue

4. check via winbox simple queue statistics to see if your traffic is being queued, in contrast to internet interface counter have to be similar if all is working correct
 
asderferjerkel
just joined
Topic Author
Posts: 3
Joined: Fri Nov 20, 2015 3:08 pm

Re: PCQ not dividing bandwidth evenly

Mon Nov 23, 2015 8:44 am

1. take in count your real wan available bandwidth for queuing to work perfectly you have to use only 80-90% of real bandwidth as total queue

2. you have to queue all the traffic incoming and outgoing to internet without leaks

3. try with a simpler configuration, i think that configa can be done with only one simple queue

4. check via winbox simple queue statistics to see if your traffic is being queued, in contrast to internet interface counter have to be similar if all is working correct
I think you hit the nail on the head with the 80-90% figure! I set my max-limit to 550k (80% of capacity) and now the split looks much more even:

Image

Re 3) I'm only using the first queue now - with packet marks I had issues with some internet traffic not being marked. Queuing on the WAN interface seems much more reliable.

Thanks for the help!
 
freemannnn
Long time Member
Long time Member
Posts: 669
Joined: Sun Oct 13, 2013 7:29 pm

Re: PCQ not dividing bandwidth evenly

Mon Nov 23, 2015 8:13 pm

i was using pcq for 2 years (pcq-rate=0) until i found out that if a user starts an upload he is taking all the bandwidth and users that are downloading are starving. test it for your self.

my setup for adsl line was:
/queue simple
add max-limit=768k/8M name=main queue=pcq-upload-default/pcq-download-default target=192.168.88.0/24 total-queue=default
test method:
i put my iphone to upload to icloud a big video so it was taking almost all 768k bandwidth for a long time. you can use any service to upload like dropbox,google drive etc
after that my pc that i was using to playing internet radio starts making pauses and web pages open really slow. if i start a download the speed was under 100kb/s and not 800kb/s.
you can observe in winbox that upload is fully uploading and downloading is starving

one solution for this it was to limit upload per connection (pcq-rate=300k) but with this solution max upload is always 300k per device even nobody is uploading. but that gave space for upload and download simultaneously.
 
User avatar
chechito
Forum Guru
Forum Guru
Posts: 1743
Joined: Sun Aug 24, 2014 3:14 am
Location: Bogota Colombia
Contact:

Re: PCQ not dividing bandwidth evenly

Tue Nov 24, 2015 6:39 pm

taken from other vendor documentation and adapted to routeros terminology

this recommendations have worked well for me
Traffic Shaping Objectives

Traffic shaping operates by measuring and queuing IP packets with respect to a number of
configurable parameters. The objectives are:
• Applying bandwidth limits and queuing packets that exceed configured limits, then sending
them later when bandwidth demands are lower.
• Dropping packets if packet buffers are full. The packets to be dropped should be chosen from
those that are responsible for the congestion.
• Prioritizing traffic according to administrator decisions. If traffic with a high priority increases
while a communication line is full, traffic with a low priority can be temporarily limited to
make room for the higher priority traffic.
• Providing bandwidth guarantees. This is typically accomplished by treating a certain amount
of traffic (the guaranteed amount) as high priority. The traffic that is in excess of the
guarantee then has the same priority as other traffic, competing with all the other
non-prioritized traffic.
Traffic shaping does not typically work by queuing up immense amounts of data and then
sorting out the prioritized traffic to send before sending non-prioritized traffic. Instead, the
amount of prioritized traffic is measured and the non-prioritized traffic is limited dynamically so
that it will not interfere with the throughput of prioritized traffic.


Limits should not be more than the Available Bandwidth
If queue limits are set higher than the available bandwidth, the queue will not know when the
physical connection has reached its capacity. If the connection is 500 Kbps but the total queue
limit is set to 600 Kbps, the queue will believe that it is not full and it will not throttle lower
priorities.

Limits should be less than Available Bandwidth
queue limits should be below the network bandwidth. A recommended value is to make
the queue limit 80-90% of the physical limit. The need for this difference becomes less with increasing
bandwidth since represents an increasingly larger piece of the total.
The reason for the lower pipe limit is For outbound
connections where packets leave the router, there is always the possibility that
might slightly overload the connection because of the software delays involved in
deciding to send packets and the packets actually being dispatched from buffers.
For inbound connections, there is less control over what is arriving and what has to be processed
by the traffic shaping system and it is therefore more important to set pipe limits slightly
below the real connection limit to account for the time needed for queuing to adapt to
changing conditions.

Watching for Leaks
When setting out to protect and shape a network bottleneck, make sure that all traffic passing
through that bottleneck passes through the defined queues.
If there is traffic going through the Internet connection that the queues do not know about,
queuing cannot know when the Internet connection becomes full.
The problems resulting from leaks are exactly the same as in the cases described above. Traffic
"leaking" through without being measured by pipes will have the same effect as bandwidth
consumed by parties outside of administrator control but sharing the same connection.
 
asderferjerkel
just joined
Topic Author
Posts: 3
Joined: Fri Nov 20, 2015 3:08 pm

Re: PCQ not dividing bandwidth evenly

Wed Nov 25, 2015 7:13 am

i was using pcq for 2 years (pcq-rate=0) until i found out that if a user starts an upload he is taking all the bandwidth and users that are downloading are starving. test it for your self.

my setup for adsl line was:
/queue simple
add max-limit=768k/8M name=main queue=pcq-upload-default/pcq-download-default target=192.168.88.0/24 total-queue=default
test method:
i put my iphone to upload to icloud a big video so it was taking almost all 768k bandwidth for a long time. you can use any service to upload like dropbox,google drive etc
after that my pc that i was using to playing internet radio starts making pauses and web pages open really slow. if i start a download the speed was under 100kb/s and not 800kb/s.
you can observe in winbox that upload is fully uploading and downloading is starving

one solution for this it was to limit upload per connection (pcq-rate=300k) but with this solution max upload is always 300k per device even nobody is uploading. but that gave space for upload and download simultaneously.
That sounds about right for an asymmetric connection - I'm actually on Wimax here, so I can upload and download at 700kbps simultaneously. Definitely makes it easier to deal with!

Who is online

Users browsing this forum: No registered users and 95 guests