Community discussions

MikroTik App
 
RK
Long time Member
Long time Member
Topic Author
Posts: 565
Joined: Tue Nov 21, 2006 11:22 am
Location: Winnipeg, Canada and Central America

Prioritizing Traffic with Unknown Link Capacity

Sat Dec 05, 2009 8:27 am

This question has come up a few times on the forums but I have yet to see any solutions posted.

Suppose I have a wireless link on which the speed varies between 7 Mbps and 10 Mbps depending on the weather.
At the end of the link I have a routerboard with two computers (on different vlans, or ethernet ports or different IPs, whatever).

Can I set it up so that Computer A gets 100% of the capacity when Computer B is not in use but only 80% of the capacity when Computer B is trying to use the network?

I can't just cap Computer A at 8 Mbps because sometimes that would leave 0 Mbps for Computer B.
I can't cap them both at 7 Mbps because that's 3 Mbps wasted.

Is there a way to specify priority/queues in % instead of bits?
 
User avatar
omidkosari
Trainer
Trainer
Posts: 640
Joined: Fri Sep 01, 2006 4:18 pm
Location: Canada, Toronto

Re: Prioritizing Traffic with Unknown Link Capacity

Sat Dec 05, 2009 11:16 am

This question has come up a few times on the forums but I have yet to see any solutions posted.
Me too.
 
User avatar
butche
Trainer
Trainer
Posts: 428
Joined: Fri May 28, 2004 6:14 pm
Location: Missouri, USA
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Sat Dec 05, 2009 11:28 pm

This is a difficult task. The way to do this, would be to set limit-at values. This is something that I address directly in my training on QOS (coming up this week - http:///www.butchevans.com/ for details). You could do queue trees something like:
/queue tree
add name=Total parent=downstream max-limit=10M
add name=download_A limit-at=5M max-limit=10M parent=downstream priority=1
add name=download_B limit-at=2M max-limit=10M parent=downstream priority=2
I'm not sure that would address all of your issue, but that's the approach I'd take. It will guarantee speeds of 5M for A and 2M for B (when the link capacity is only 7M), and allow for the higher speed capability
 
Muqatil
Trainer
Trainer
Posts: 573
Joined: Mon Mar 03, 2008 1:03 pm
Location: London - UK
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Sun Dec 06, 2009 12:07 am

I would check the link capacity doing a latency test between the links,
:local ipaddress 10.100.0.18
:global latency [ping $ipaddress interval=50ms count=100]; 
Once you got your latency (about 80 pings over 50ms (assuming your link is able to support a good latency (1-2 ms average))) you can decide to lower the max-limit of your queues accordingly until the latency drops to your desired limit.
:local currentmax [/queue tree get GlobalOutQueue max-limit];
:if ($latency < 80) do={/queue tree set GlobalOutQueue max-limit=($currentmax - 1000000);};
I'm not sure this code is correct and i don't know if this will fit your needs, but maybe you got my idea to solve your problem
 
User avatar
butche
Trainer
Trainer
Posts: 428
Joined: Fri May 28, 2004 6:14 pm
Location: Missouri, USA
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Sun Dec 06, 2009 12:47 am

While I agree that the latency test may be a usable approach, it is not, by itself, a good test. This test would fail, for example, if the link was at full 10M capacity and utilization was at that rate as well.
 
User avatar
butche
Trainer
Trainer
Posts: 428
Joined: Fri May 28, 2004 6:14 pm
Location: Missouri, USA
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Sun Dec 06, 2009 1:20 am

You could use some variation on:
:local "tx-total-average";
:local speed 0;
/tool bandwidth-test address=192.168.5.1 user=admin password=**** protocol=tcp  duration=4s  direction=both do={
     :set speed $"tx-total-average";
     :if ($"speed" < 9000000 ) do={
          /queue tree set [find] max-limit=7000000
      }
}
Just for example. Not fully tested
 
RK
Long time Member
Long time Member
Topic Author
Posts: 565
Joined: Tue Nov 21, 2006 11:22 am
Location: Winnipeg, Canada and Central America

Re: Prioritizing Traffic with Unknown Link Capacity

Sun Dec 06, 2009 6:14 am

The problem with doing a speed test is that it would give incorrect results because the link is already in use.
Of course, I can't turn off the users before every test.

The ping solution is decent.
Is that as good as it gets or someone knows something better?
 
User avatar
butche
Trainer
Trainer
Posts: 428
Joined: Fri May 28, 2004 6:14 pm
Location: Missouri, USA
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Sun Dec 06, 2009 6:58 am

Not many choices here. The queue structure I showed is really the best approach and it will work for what you want. I only presented the option of the speedtest since we were playing with scripting. :-)
 
RK
Long time Member
Long time Member
Topic Author
Posts: 565
Joined: Tue Nov 21, 2006 11:22 am
Location: Winnipeg, Canada and Central America

Re: Prioritizing Traffic with Unknown Link Capacity

Sun Dec 06, 2009 10:11 am

This is a difficult task. The way to do this, would be to set limit-at values. [...]
/queue tree
add name=Total parent=downstream max-limit=10M
add name=download_A limit-at=5M max-limit=10M parent=downstream priority=1
add name=download_B limit-at=2M max-limit=10M parent=downstream priority=2
I tried "limit-at" in 3.30 but it seems to do nothing at all. Any ideas if it works in older or newer versions?
As for the "max-limit" settings in your queue, what is the point? Am I not going to get the same result if I set max-limit to 30M or nothing at all (if limit-at worked)?
 
User avatar
butche
Trainer
Trainer
Posts: 428
Joined: Fri May 28, 2004 6:14 pm
Location: Missouri, USA
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Sun Dec 06, 2009 5:10 pm

This is a difficult task. The way to do this, would be to set limit-at values. [...]
I tried "limit-at" in 3.30 but it seems to do nothing at all. Any ideas if it works in older or newer versions?
As for the "max-limit" settings in your queue, what is the point? Am I not going to get the same result if I set max-limit to 30M or nothing at all (if limit-at worked)?
/queue tree
add name=Total parent=downstream max-limit=10M
add name=download_A limit-at=5M max-limit=10M parent=downstream priority=1 packet-mark=comp1
add name=download_B limit-at=2M max-limit=10M parent=downstream priority=2 packet-mark=others
/ip firewall mangle
add chain=forward src-address=10.10.10.10 action=mark-packet new-packet-mark=comp1 
add chain=forward dst-address=10.10.10.10 action=mark-packet new-packet-mark=comp1
add chain=forward action=mark-packet new-packet-mark=others 
I did not include the full implementation. This is closer to complete.
 
RK
Long time Member
Long time Member
Topic Author
Posts: 565
Joined: Tue Nov 21, 2006 11:22 am
Location: Winnipeg, Canada and Central America

Re: Prioritizing Traffic with Unknown Link Capacity

Mon Dec 07, 2009 1:04 am

I did not include the full implementation. This is closer to complete.
I already did all the packet marks on my own. Thanks tho.
I think "limit-at" is broken, but, before we address that, a question remains, is "max-limit" needed here at all?
 
User avatar
butche
Trainer
Trainer
Posts: 428
Joined: Fri May 28, 2004 6:14 pm
Location: Missouri, USA
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Mon Dec 07, 2009 1:13 am

Needed - maybe not. At least the parent needs to know the total available bandwidth. I just did a test on 3.30 with this exact configuration and it works just right. I don't know what part is not working in your config, or which version you are using, but I do not experience a "broken" limit-at value.
 
User avatar
butche
Trainer
Trainer
Posts: 428
Joined: Fri May 28, 2004 6:14 pm
Location: Missouri, USA
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Mon Dec 07, 2009 1:18 am

CRAP! I just saw my error. I have the parents wrong (which is why it isn't working for you). Try THIS one.
/queue tree
add name=Total parent=downstream max-limit=10M
add name=download_A limit-at=5M max-limit=10M parent=Total priority=1 packet-mark=comp1
add name=download_B limit-at=2M max-limit=10M parent=Total priority=2 packet-mark=others
/ip firewall mangle
add chain=forward src-address=10.10.10.10 action=mark-packet new-packet-mark=comp1
add chain=forward dst-address=10.10.10.10 action=mark-packet new-packet-mark=comp1
add chain=forward action=mark-packet new-packet-mark=others 
In my haste, I made the child queues use the interface as parent instead of the "Total" queue, which is what it is supposed to be. Sorry about that. With THIS config it will work as advertised. :? :?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Mon Dec 07, 2009 1:55 am

have anybody played with 'ping-speed'?

also, maybe it's possible to check current link's capacity in scheduler and then correct queue's parameters
 
RK
Long time Member
Long time Member
Topic Author
Posts: 565
Joined: Tue Nov 21, 2006 11:22 am
Location: Winnipeg, Canada and Central America

Re: Prioritizing Traffic with Unknown Link Capacity

Mon Dec 07, 2009 6:58 am

CRAP! I just saw my error. I have the parents wrong (which is why it isn't working for you). Try THIS one.
That's one of the combinations I tried yesterday, but it still didn't work.
What is "downstream"? Is that supposed to be the ethernet interface both computers are on?
 
User avatar
butche
Trainer
Trainer
Posts: 428
Joined: Fri May 28, 2004 6:14 pm
Location: Missouri, USA
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Mon Dec 07, 2009 7:04 am

Yes, downstream would be the name of an interface. If you have 10M download capability, then downstream would be the side facing the computers. If this is a bridge interface, then we have to adjust the rules and mangles.
 
RK
Long time Member
Long time Member
Topic Author
Posts: 565
Joined: Tue Nov 21, 2006 11:22 am
Location: Winnipeg, Canada and Central America

Re: Prioritizing Traffic with Unknown Link Capacity

Mon Dec 07, 2009 7:11 am

With THIS config it will work as advertised. :? :?
Just tried it again. 100% fail.
If I run a speed test with 20 threads on one computer, and 1 thread on the other, the one with 20 threads gets 90% + of the link.
If I flip the test locations, again the computer with more threads gets almost all the link.

It's as if the "limit-at" setting gets ignored.
 
Muqatil
Trainer
Trainer
Posts: 573
Joined: Mon Mar 03, 2008 1:03 pm
Location: London - UK
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Mon Dec 07, 2009 10:25 am

did u add the passthrough=no on the first 2 mangle rules? Otherwise it will remark everything as "other"
 
RK
Long time Member
Long time Member
Topic Author
Posts: 565
Joined: Tue Nov 21, 2006 11:22 am
Location: Winnipeg, Canada and Central America

Re: Prioritizing Traffic with Unknown Link Capacity

Mon Dec 07, 2009 10:46 pm

did u add the passthrough=no on the first 2 mangle rules? Otherwise it will remark everything as "other"
Yes. I checked and the expected traffic is showing up in the expected queue but limit-at is being ignored.

Have any of you seen limit-at work recently?
 
RK
Long time Member
Long time Member
Topic Author
Posts: 565
Joined: Tue Nov 21, 2006 11:22 am
Location: Winnipeg, Canada and Central America

Re: Prioritizing Traffic with Unknown Link Capacity

Mon Jan 03, 2011 9:36 pm

Suppose I have a wireless link on which the speed varies between 7 Mbps and 10 Mbps depending on the weather.
At the end of the link I have a routerboard with two computers (on different vlans, or ethernet ports or different IPs, whatever).

Can I set it up so that Computer A gets 100% of the capacity when Computer B is not in use but only 80% of the capacity when Computer B is trying to use the network?

I can't just cap Computer A at 8 Mbps because sometimes that would leave 0 Mbps for Computer B.
I can't cap them both at 7 Mbps because that's 3 Mbps wasted.

Is there a way to specify priority/queues in % instead of bits?
It has been a while since I first posed this question.
Has anybody come up with a solution since?
 
User avatar
butche
Trainer
Trainer
Posts: 428
Joined: Fri May 28, 2004 6:14 pm
Location: Missouri, USA
Contact:

Re: Prioritizing Traffic with Unknown Link Capacity

Mon Jan 03, 2011 9:42 pm

It has been a while since I first posed this question.
Has anybody come up with a solution since?
It works as I showed early on in the thread. At least I can say it works here. I'm not sure what isn't working there. There is still no way to specify speed limits (or reservations) as a percentage.

Who is online

Users browsing this forum: Bing [Bot] and 168 guests