I am working on assuring low delay for UDP traffic at the home gateway level. At this home gateway I have two types of traffic, TCP and UDP, and I assure differentiated treatment by using HTB. The bandwidth I am testing equals 1Mbit/s (thus it is connected to emulated ADSL 1Mbit link).
I use the following configuration:
tc qdisc add dev br0 handle 1: root htb default 15 tc class add dev br0 parent 1: classid 1:1 htb rate 1000kbit ceil 1000kbit tc class add dev br0 parent 1:1 classid 1:14 htb rate 200kbit ceil 1000kbit prio 1 tc class add dev br0 parent 1:1 classid 1:15 htb rate 10bit ceil 1000kbit prio 2 tc filter add dev br0 parent 1: protocol ip u32 match ip tos 0xb8 0xff flowid 1:14 (UDP) tc filter add dev br0 parent 1: protocol ip u32 match ip tos 0x00 0xff flowid 1:15 (TCP) tc qdisc add dev br0 parent 1:14 handle 20: sfq limit 40 tc qdisc add dev br0 parent 1:15 handle 50: pfifo limit 1000
In order to see how the traffic interacts, for UDP I use a "stairs" type of traffic, thus I start at 0bit/s and I increase the traffic every ten seconds by 100kbit/s. When I reach 1Mbit/s I decrease every 10s by 100kbit/s until I reach zero.
Alongside, I have TCP traffic, either a file upload, either a simple iperf (without any influence on observed behavior).
Normally, most of the time, I get an expected behavior. Thus I can see perfectly the TCP/UDP traffic separation and the “stairs” trend of the UDP. Additionally, UDP traffic takes over TCP (but TCP can still send – and the trend is the opposite of UDP, thus first decreasing, later increasing).
However from time to time I can see TCP completely taking over UDP traffic for a couple of seconds. It happens between 1 and 3 times during the test. In general it happens at least once, when UDP bitrate is already decreasing (about 30 seconds before reaching 0), TCP traffic completely takes over for a couple of seconds (3 to 5 seconds). I can’t really understand this behavior, because it seems that UDP traffic cannot send, but it shouldn’t be above its ceil since its bitrate is already decreasing.
I think it has something to do with HTB scheduling and blocking high priority traffic for some reason. Thus when rate is calculated for my high priority traffic, it somehow is higHer than its ceil.
- But why would high priority traffic reach its ceil if the bitrate is lower?
- Why could low priority traffic block the other one for several seconds, even though its assured rate is close to zero?
I have tried changing different parameters (burst, ceil, rates), but cannot see any improvement.
Thank you in advance for your help.