gadolf
October 24, 2024, 2:56pm
1
Hi!
I'm curious to know why cake is using the Best Effort tin for a download, and not Bulk.
In this example, I was using bittorrent to download a file and, as you can see in the table indicated by the red arrows, most of the traffic goes thru the BE tin.
Cake does not really care It will essentially steer packets into its different tins, based on a hardcoded mapping of DSCP values to tins. Normally packets cpme with DSCP 0 and that DSCP is mapped to best effort (as it should arguably). If you want to move stuff to different tins you need to set one of those DSCP values that map into the desired tin. For egress traffic that can be achieved directly on the host sendind the packets, or by the firewall on the router. For ingress traffic things used to be pretty dire, but the DSCP classify and qosmate and ... projects solved that by copying the egress dscp to ingressing packets of the same flow.
Tl;dr: cake does not know what you want all it does look at the DSCPs
2 Likes
grrr2
October 24, 2024, 9:23pm
3
hi,
side question pls: what exporter are you using to have all these details available in Grafana?
gadolf
October 24, 2024, 10:50pm
4
I use collectd snmp plugin.
In order to feed snmp with cake metrics, I run the following procedure:
Every second, execute cakev2.sh to store all cake metrics into temporary files;
Extend snmp agent to store all metrics previously saved into specific OID's;
Have collectd extract those specific snmp OID's
Then, it's business as usual, collectd data fed into prometheus.
What do you think?
EDIT: cakev2.sh:
#!/bin/bash
function doit {
echo DOIT threshold_rate$Index $threshold_rate bandwidth $bandwidth$direcao
echo $target_us > /etc/snmp/cakeresults/$Index'target'$direcao
echo $peak_delay_us > /etc/snmp/cakeresults/$Index'peak_delay'$direcao
echo $avg_delay_us > /etc/snmp/cakeresults/$Index'avg_delay'$direcao
echo $base_delay_us > /etc/snmp/cakeresults/$Index'base_delay'$direcao
echo $drops > /etc/snmp/cakeresults/$Index'drops'$direcao
echo $ecn_mark > /etc/snmp/cakeresults/$Index'ecn_mark'$direcao
echo $sparse_flows > /etc/snmp/cakeresults/$Index'sparse_flows'$direcao
echo $bulk_flows > /etc/snmp/cakeresults/$Index'bulk_flows'$direcao
echo $unresponsive_flows > /etc/snmp/cakeresults/$Index'unresponsive_flows'$direcao
echo $sent_bytes > /etc/snmp/cakeresults/$Index'sent_bytes'$direcao
}
function doit1 {
echo DOIT1 backlog= $backlog $bytes $packets $qlen $drops $bandwidth ...
echo $backlog > /etc/snmp/cakeresults/backlog$direcao
echo $bytes > /etc/snmp/cakeresults/bytes$direcao
echo $packets > /etc/snmp/cakeresults/packets$direcao
echo $qlen > /etc/snmp/cakeresults/qlen$direcao
echo $drops > /etc/snmp/cakeresults/drops$direcao
echo $bandwidth > /etc/snmp/cakeresults/bandwidth$direcao
}
function get {
# Trata o primeiro nível de keys do objeto
eval $(jq -r '.[]|
# salva o valor das keys de primeiro nível (mais externo). Elas serão
# usadas na última linha, definindo variáveis para a função doit
select (.kind == "cake") |
. as {
backlog: $backlog, bytes: $bytes, packets: $packets, qlen: $qlen, drops: $drops, options: {$bandwidth}
} |
["backlog=\($backlog)", "bytes=\($bytes)", "packets=\($packets)", "qlen=\($qlen)", "drops=\($drops)", "bandwidth=\($bandwidth)"] | join(" ") | . + " doit1;"
' $arquivo
)
# Trata o array tins
eval $(jq -r '.[]|
# Isola as tin num array, acrescentando um campo de índice que sera
# usado para dar nome aos arquivos finais
select (.kind == "cake") |
foreach .tins[] as $tin (-1; . + 1; [{index: ., tin: $tin}]) |
.[] as {index: $ind, tin: $tin} | $tin | [keys_unsorted[] as $key | " \($key)" + @sh "=\(.[$key])"] | join("") |
@sh "Index=\($ind)" + . + " doit;"
' $arquivo
)
}
/sbin/tc -s -j qdisc show dev ifb4enp2s0 > /tmp/cake
direcao=""
arquivo=/tmp/cake
get
/sbin/tc -s -j qdisc show dev enp2s0 > /tmp/cakeup
direcao="up"
arquivo=/tmp/cakeup
get
EDIT 2: Forgot to mention, this is on a x86/64 debian router, but certainly portable to openwrt
grrr2
October 25, 2024, 1:18pm
5
ok, so you process the json output. nice!
thank you for sharing this!
1 Like