Community discussions

MikroTik App
 
vlad49
just joined
Topic Author
Posts: 3
Joined: Fri Sep 15, 2006 8:08 pm

>1000 simple queues - how to update them all?

Mon May 18, 2009 9:17 am

Hello! I have about 1200 simple queue rules and I need to change them twice a day because our customers must have higher speeds at nighttime. To do that I run ssh to mikrotik with the following very very long command:

/queue simple remove id9253; /queue simple add name=id9253 dst-address=0.0.0.0/0 target-addresses=192.168.10.129/32 parent=none direction=both priority=8 queue=default-small/default-small limit-at=64000/64000 max-limit=64000/64000 total-queue=default-small;/queue simple remove id9349; /queue simple add name=id9349 dst-address=0.0.0.0/0 target-addresses=192.168.11.225/32 parent=none direction=both priority=8 queue=default-small/default-small limit-at=128000/128000 max-limit=128000/128000 total-queue=default-small;/queue simple ............................

The total length of the command is about 25000 characters, and total number of chunks is about 10-15 to change all the queues. Everything worked fine when we had no more than 700-800 queues but now it takes more than an hour to update them all. I think this is because mikrotik writes every queue change to flash and number of changes is huge.

Can I change this behavior? Is there any way to disable mikrotik writing all changes to disk, or write them only after all ssh commands are executed?

Thanks a lot!
 
User avatar
n2m
newbie
Posts: 47
Joined: Mon Feb 25, 2008 8:48 am

Re: >1000 simple queues - how to update them all?

Mon May 18, 2009 10:13 am

Why dont you use scripts :shock: !? You can use scripts and scheduler to automatically do that.

/system script
add name=script1 policy=read,write source="queue simple set \"the name here\" limit=128000/128000 max-limit=256000/256000

/system scheduler
add comment="" disabled=no interval=1d name=schedule1 on-event=script1 start-date=jan/01/1970 start-time=00:00:00
 
vlad49
just joined
Topic Author
Posts: 3
Joined: Fri Sep 15, 2006 8:08 pm

Re: >1000 simple queues - how to update them all?

Mon May 18, 2009 10:47 am

Why dont you use scripts :shock: !? You can use scripts and scheduler to automatically do that.

/system script
add name=script1 policy=read,write source="queue simple set \"the name here\" limit=128000/128000 max-limit=256000/256000
It's better to use ssh because number of customers and their speeds change every day - so I'd have to change the script every time. It's much more convenient to run ssh and change rules directly.

In any case the question is about the speed of rule updates. Changing options of a few thousand rules is not a hard task - but why it takes hours to be done? I don't think the script could do the things faster.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26968
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia
Contact:

Re: >1000 simple queues - how to update them all?

Mon May 18, 2009 10:52 am

setting aside the original question, but - why do you need thousands of queues? does each customer have an entirely unique speed set on him? why not use PCQ instead? this would DRAMATICALLY improve the performance of your router
 
vlad49
just joined
Topic Author
Posts: 3
Joined: Fri Sep 15, 2006 8:08 pm

Re: >1000 simple queues - how to update them all?

Mon May 18, 2009 11:02 am

setting aside the original question, but - why do you need thousands of queues? does each customer have an entirely unique speed set on him? why not use PCQ instead? this would DRAMATICALLY improve the performance of your router
This is because each customer could have several IPs sometimes even from different subnets, and the rate should divide between all these IPs. As I understand PCQ provides individual rate for each IP in queue which is not good.
 
chronos
newbie
Posts: 32
Joined: Tue Aug 05, 2008 3:54 pm

Re: >1000 simple queues - how to update them all?

Wed May 20, 2009 10:29 am

I have complex queues with many rows in router too. Currently I have about 650 records in it with queue tree used for per customer and per customer host fashion. But I do update this rules manually only sometimes.
But it takes about 2 minutes to complete reload all settings through ssh form main server. More items is in list inside routeros than more time takes to add new item. CPU usage is near 100% during uploading queues.
If router is loaded by intense traffic it take even longer to upload queue setting.

Problem should by solved by change of conception or if it is not possible than doing optimization and instead of do full list reload do synchronization and transfer only changed values. Than queue generator script shout have their own copy of table in database and should update only differences. This means use of insert new, remove old and set updated.

Another improvement could be some sort list update locking mechanism like combination of BeginUpdate and EndUpdate procedures.

Using more powerful shaping server with more cpu power could be solution too.
 
User avatar
ahmadzai
just joined
Posts: 18
Joined: Wed Sep 02, 2015 8:35 am
Location: Kabul
Contact:

Re: >1000 simple queues - how to update them all?

Mon Sep 25, 2017 12:01 pm

Hi,

i have solution for this problem and i designed my own experience script for it and by just one click its changing and its work based on the queue comment it didn't depend on changing of queue bandwidth.
 
emikrotik
Frequent Visitor
Frequent Visitor
Posts: 71
Joined: Fri Jun 19, 2015 9:30 am

Re: >1000 simple queues - how to update them all?

Tue Sep 26, 2017 10:37 am

Create a script and use a foreach loop to go through every queue.

:foreach i in=[/queue simple] do={
/queue simple set max-limit=10/10M numbers=$i
}