User comments on ISPs
  >> Zen Internet


Register (or login) on our website and you will not see this ad.


Pages in this thread: 1 | [2] | (show all)   Print Thread
Standard User deleted
(deleted) Sat 29-Jun-13 17:27:05
Print Post

Re: Understanding packet loss on the first hop


[re: deleted] [link to this post]
 
I have now finished my 'first' implementation of shaping:

Text
1
23
45
67
89
1011
1213
1415
1617
1819
2021
2223
2425
2627
#!/bin/bash
  
# ConfigurationDSL_STATS=/run/shm/dsl_info/dsl_info
 # Making sure DSL stats are available
[[ -f "$DSL_STATS" ]] && { 
        # Calculating upstream limit - 95% of the current bandwidth to cope with overhead        limit="$(awk '/Current upstream/ { split($0, data, "|"); upload = (data[2] / 8) * (95 / 100); print upload }' "$DSL_STATS")"
} 
# Making sure at least a conservative limit is set[[ -z $limit || $limit == "" ]] && limit=900
 # Giving ppp0 a proper queue length so prioritisation can actually happen, rather than dropping everything... is 3 by default!
ifconfig ppp0 txqueuelen 100 
# Add initial HTB qdisc on the roottc qdisc add dev ppp0 root handle 1: htb default 1
 # Actually add the HTB class that limits upload to 95% of sync rate (deals with overhead)
tc class add dev ppp0 parent 1:0 classid 1:1 htb rate "$limit"kibps ceil "$limit"kibps 
# Add a prio qdisc to this class to then use TOS to prioritise the packets into 3 bands, only dequeuing from higher ones when all the lower bands are emptiedtc qdisc add dev ppp0 parent 1:1 handle 100: prio


Separate init.d bash and AWK scripts take care of logging into the Huawei Gateway to pull the stats and dump in a useful form. TOS is already set in the originating programs or forced via iptables rules (e.g. SSH likes to downgrade TOS as soon as you run a command, so needs to be forced to Minimize-Delay).

This script resides in '/etc/ppp/ip-up.d' so runs when the ppp interface appears - otherwise nothing is persisted.

So far this basic shaping looks to be doing the job - my main source of documentation has been Journey to the Center of the Linux Kernel: Traffic Control, Shaping and QoS.

One thing I've noted is where to involve CoDel, the recent anti-bufferbloat queuing discipline - none of the CoDel qdiscs talk about TOS, which is what I want to prioritise my traffic by - presumably by using HTB and prio queues 100 packets long, I cant just stick a CoDel queue on the end to make it magically better - and is only 100 packets long worth considering bufferbloat over...
Standard User deleted
(deleted) Sat 29-Jun-13 17:31:50
Print Post

Re: Understanding packet loss on the first hop


[re: deleted] [link to this post]
 
Why not just prioritise upstream ACK's? Then there's need to reduce the downstream to 95%.
Standard User deleted
(deleted) Sat 29-Jun-13 17:34:32
Print Post

Re: Understanding packet loss on the first hop


[re: deleted] [link to this post]
 
Nothing todo with downstream - this is all on upstream.

Upstream ACKs are already prioritised via TOS (in my firewall script):

Text
1
2
# TCP ACK packets with no or very little data payload (p2p traffic sets all packets to ACK packets otherwise, source of size: http://phix.me/dm/)
$IPTABLES -t mangle -A POSTROUTING -o ppp0 -p tcp --tcp-flags FIN,SYN,RST,ACK ACK -m length --length 40:89 -j TOS --set-tos Minimize-Delay


Register (or login) on our website and you will not see this ad.

Standard User deleted
(deleted) Sat 29-Jun-13 17:40:35
Print Post

Re: Understanding packet loss on the first hop


[re: deleted] [link to this post]
 
That's alright then smile
Standard User deleted
(deleted) Sat 29-Jun-13 18:34:05
Print Post

Re: Understanding packet loss on the first hop


[re: deleted] [link to this post]
 
One glaring omission with all this is that I cant actually see what the 3 bands are doing :/

The normal command to inspect the qdiscs is 'tc -s -d -iec qdisc show dev ppp0', example output:

qdisc htb 1: root refcnt 2 r2q 10 default 1 direct_packets_stat 0 ver 3.17
Sent 2721386541 bytes 2721920 pkt (dropped 20, overlimits 2978755 requeues 0)
backlog 0b 10p requeues 0
qdisc prio 100: parent 1:1 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
Sent 2721386541 bytes 2721920 pkt (dropped 20, overlimits 0 requeues 0)
backlog 0b 10p requeues 0
Standard User deleted
(deleted) Wed 07-Aug-13 21:26:49
Print Post

Re: Understanding packet loss on the first hop


[re: deleted] [link to this post]
 
I've since improved on that command - the packets are actually going through the classes rather than the qdiscs:

tc -s -d -iec class show dev ppp0


Resulting in:

class htb 1:1 root leaf 100: prio 0 quantum 92160 rate 7200Kibit ceil 7200Kibit burst 1599b/1 mpu 0b overhead 0b cburst 1599b/1 mpu 0b overhead 0b level 0
Sent 319470213970 bytes 360945636 pkt (dropped 1383465, overlimits 0 requeues 0)
rate 3532Kibit 447pps backlog 0b 13p requeues 0
lended: 280357898 borrowed: 0 giants: 0
tokens: -15673821 ctokens: -15673821

class prio 100:1 parent 100:
Sent 720405240 bytes 1114854 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
class prio 100:2 parent 100:
Sent 99874720283 bytes 111247099 pkt (dropped 12715, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
class prio 100:3 parent 100:
Sent 218875088447 bytes 248583683 pkt (dropped 1370750, overlimits 0 requeues 0)
backlog 9317b 13p requeues 0
Pages in this thread: 1 | [2] | (show all)   Print Thread

Jump to