LibreQoE / LibreQoS

A Quality of Experience and Smart Queue Management system for ISPs. Leverage CAKE to improve network responsiveness, enforce bandwidth plans, and reduce bufferbloat.
https://libreqos.io/
GNU General Public License v2.0
416 stars 47 forks source link

Performance improvements during reloading #526

Open interduo opened 2 months ago

interduo commented 2 months ago

I caught one more thing:

class add dev ens20 parent 0x1a:0xdb0 classid 0xe3b htb rate 327mbit ceil 327mbit prio 3 quantum 4087500 # CircuitID: 29279 DeviceIDs: e51, | Comment: KOMENTARZ
qdisc add dev ens20 parent 0x1a:0xe3b cake diffserv4
class add dev ens19 parent 0x1a:0xdb0 classid 0xe3b htb rate 327mbit ceil 327mbit prio 3 quantum 4087500
qdisc add dev ens19 parent 0x1a:0xe3b cake diffserv4
class add dev ens20 parent 0x1a:0xdb0 classid 0xe3c htb rate 654mbit ceil 654mbit prio 3 quantum 8175000 # CircuitID: 29524 DeviceIDs: e6c, | Comment: KOMENTARZ
qdisc add dev ens20 parent 0x1a:0xe3c cake diffserv4
class add dev ens19 parent 0x1a:0xdb0 classid 0xe3c htb rate 654mbit ceil 654mbit prio 3 quantum 8175000
qdisc add dev ens19 parent 0x1a:0xe3c cake diffserv4

The "batch" file linux_tc.txt contains rules for all interfaces - this is not optimal Suggestion: make file every network interface and load it simultaneously.

Let's do some measure:

Test1: try to load interface qdisc/classes batch file individualy

root@libreqos-beta:/opt/libreqos/src# time tc -b ./tc_ens19.txt
real    0m2.540s
user    0m0.058s
sys 0m2.481s

root@libreqos-beta:/opt/libreqos/src# time tc -b ./tc_ens20.txt
real    0m3.130s
user    0m0.057s
sys 0m3.073s

Test2: try to load interface qdisc/classes batch file

root@libreqos-beta:/opt/libreqos/src# time tc -b ./linux_tc.txt
real    0m6.207s
user    0m0.127s
sys 0m6.079s

0.5sec win/10% of tc loading time

Test3: batch commands for tc with del root outside batch

$ cat ./script.sh 
tc qdisc delete dev ens19 root
tc -b ./tc_ens19.txt
tc qdisc delete dev ens20 root
tc -b ./tc_ens20.txt
root@libreqos-beta:/opt/libreqos/src# time ./script.sh
real    0m10.334s
user    0m0.109s
sys 0m10.175s
head -n3 tc_ens19_withdelroot.txt
qdisc delete dev ens19 root
qdisc replace dev ens19 root handle 7FFF: mq
qdisc add dev ens19 parent 7FFF:0x1 handle 0x1: htb default 2
time ./script_withdelroot.sh 

real    0m10.091s
user    0m0.122s
sys 0m9.928s

~220ms win not that bad...

Test4: using parallel command for loading batch files for individual ifaces simultaneously

time parallel tc -b ::: ./tc_ens19_withdelroot.txt ./tc_ens20_withdelroot.txt;

root@libreqos-beta:/opt/libreqos/src# time parallel tc -b ::: ./tc_ens19_withdelroot.txt ./tc_ens20_withdelroot.txt;

real    0m8.224s
user    0m0.247s
sys 0m13.818s

vs

/opt/libreqos/src# time ./script_withdelroot.sh 

real    0m10.191s
user    0m0.122s
sys 0m9.928s

Do I see it correctly: 0m8.224s vs 0m10.191s almost 2seconds reloading less time? Could somebody do the same tests?