Community discussions

MikroTik App
 
clueluzz
newbie
Topic Author
Posts: 34
Joined: Sun Feb 23, 2020 5:47 pm
Location: Jakarta, Indonesia
Contact:

Load Balance PCC math

Tue Jun 21, 2022 4:53 am

Hi,

I have a question since all the stuff I've read about LB PCC math for 2 WAN is something like 20Mbps+10Mbps = 10+10+10.

Any suggestion on how to calculate 300M DL / 80M UL with a symmetrical 120/120M?
 
sindy
Forum Guru
Forum Guru
Posts: 10206
Joined: Mon Dec 04, 2017 9:19 pm

Re: Load Balance PCC math

Tue Jun 21, 2022 9:44 am

First, it's all statistics. You can distribute the connections using the ratio you choose, but that doesn't mean the bandwidth occupation will be distributed that way, unless we talk about at least hundreds of connections.

Second, there is no way to use a different distribution ratio for upload and for download, because the WAN must be chosen as the very first packet of a connection is being processed. And the very first packet of a connection carries no information regarding whether the connection will be used for download, upload, or both.

All the above applies for general traffic - of course, if you have a specific traffic you can reliably identify, you can create more specific rules for that traffic, and you can use individual rules for upload and download one since you know which is which in advance (a simple but useless example - SMTP traffic from your local server will always be an upload one, whereas SMTP traffic towards your local server will always be a download one). The question is whether the share of predictable traffic is large enough to matter.

Now even if we ignore all the above, I did not understand what you mean by calculating 300 M DL across two links with 120 M DL each - there's still 60 M of bandwidth missing to satisfy the 300 M requirement. Whereas any of the two links is sufficient for the 80 M UL. Can you clarify?
 
clueluzz
newbie
Topic Author
Posts: 34
Joined: Sun Feb 23, 2020 5:47 pm
Location: Jakarta, Indonesia
Contact:

Re: Load Balance PCC math

Tue Jun 21, 2022 10:20 am

I came across a load balancing calculator for PCC whereby if two WANs are connected, the PCC is not X + Y. There's a way to calculate a numerator of the split in bandwidth then to be applied to the denominator in the pcc mangle. I'll attach the screenshot. This page is useful but the script only allows for the WAN calculation to be upto 100Mbps, so I'm trying to do the math (so long as I know how to do it) to make the formulation to create the necessary mangles.

Screen Shot 2022-06-21 at 14.09.55.png

I'm hoping if I get this right, I can more evenly use the bandwidth across the 2 WANs
You do not have the required permissions to view the files attached to this post.
 
sindy
Forum Guru
Forum Guru
Posts: 10206
Joined: Mon Dec 04, 2017 9:19 pm

Re: Load Balance PCC math  [SOLVED]

Tue Jun 21, 2022 10:36 am

As you can see, the calculator doesn't deal with upload and download separately - it simply doesn't care about upload at all.

The math is actually very simple - it boils down to finding the largest common denominator. Imagine you have three uplinks with download speeds 200, 100, and 50 Mbps. You can express that as a 200:100:50 ratio; all elements are divisible by 50, so you can express the same ratio as 4:2:1. To distribute the connections in this ratio, you need 4+2+1=7 cases, so the denominator in the per-connection-classifier will be 7, and the reminder values will be 0 to 6.

So with some optimisation, the rules would look as follows:
per-connection-classifier=xxx:7/0 action=mark-routing new-routing-mark=WAN50 passthrough=no
per-connection-classifier=xxx:7/1 action=mark-routing new-routing-mark=WAN100 passthrough=no
per-connection-classifier=xxx:7/2 action=mark-routing new-routing-mark=WAN100 passthrough=no
action=mark-routing new-routing-mark=WAN200


The last rule stands in place of four individual rules with 7/3 through to 7/6.

And the calculator has it wrong, 30+10 needs 4/0, 4/1, 4/2, 4/3 rather than 3/0, 3/1, 3/2.
 
clueluzz
newbie
Topic Author
Posts: 34
Joined: Sun Feb 23, 2020 5:47 pm
Location: Jakarta, Indonesia
Contact:

Re: Load Balance PCC math

Tue Jun 21, 2022 10:42 am

noted. thanks Sindy!

So for my 300:120, the lowest common denominator is 60 at a ratio of 5:2 which makes 7 split into 5 for WAN1 and 2 for WAN2.
 
Zacharias
Forum Guru
Forum Guru
Posts: 3459
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: Load Balance PCC math

Tue Jun 21, 2022 3:31 pm

@sindy thats just to ballance the weight equally ?
 
sindy
Forum Guru
Forum Guru
Posts: 10206
Joined: Mon Dec 04, 2017 9:19 pm

Re: Load Balance PCC math

Tue Jun 21, 2022 4:46 pm

@sindy thats just to ballance the weight equally ?
If by "weight" you mean "load" as in "usage", then yes, but the point is how exactly you understand "equally". If the uplinks have different bandwidth, it requires a different absolute load (in Mbit/s) to get equal relative load (% of max capacity), and this is what the OP asks about.

Who is online

Users browsing this forum: Ahrefs [Bot], alioxia, Bing [Bot], gigabyte091, ivicask, lubanglolo and 74 guests