All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Taht <dave.taht@gmail.com>
To: lartc@vger.kernel.org
Subject: Re: Qdisc HTB root overlimits and requeues
Date: Sun, 25 Jan 2015 21:48:20 +0000	[thread overview]
Message-ID: <CAA93jw6UWYCKYbSQq3Qwnk5ZtPp6WLVW-fAX6KH8HDOVEQ3JVQ@mail.gmail.com> (raw)
In-Reply-To: <000201d038dd$56ad4bf0$0407e3d0$@brest.beltelecom.by>

give fq_codel a shot instead of sfq.

see also the sqm-scripts.

requeues means that you hit a limit and had to wait for the next
scheduled round.


On Sun, Jan 25, 2015 at 12:27 PM, Дмитрий Шикуть
<dshykuts@brest.beltelecom.by> wrote:
> Hello!
>
> I created script for traffic shaping. After run, there are many overlimits
> and requeues in tc stat for htb root discipline. Is this normal or something
> going wrong?
>
> Here is script:
>
> #!/bin/sh
> ### BEGIN INIT INFO
> # Provides: trafficshaper
> # Required-Start: $network $syslog
> # Required-Stop: $network $syslog
> # Should-Start:
> # Should-Stop:
> # Default-Start: 2 3 4 5
> # Default-Stop: 0 1 6
> # Short-Description: Start and stop trafficshaper
> # Description: trafficshaper
> ### END INIT INFO
>
> PATH=/sbin:/bin:/usr/bin
>
> . /lib/init/vars.sh
> . /lib/lsb/init-functions
>
> # Reads config file (will override defaults above)
> [ -r /etc/default/trafficshaper ] && . /etc/default/trafficshaper
>
> # Devices calculation
> devDL=$dev
> devUL=ifb0
>
> # Flush discuiplines for DL and UL devices
> delete_qdisc () {
>     tc qdisc del dev $devDL ingress 2>/dev/null
>     tc qdisc del dev $devUL root 2>/dev/null
>     tc qdisc del dev $devDL root 2>/dev/null
> }
>
> case "$1" in
>     start|"")
>         log_daemon_msg "Starting trafficshaper" "ok"
>
>         # Global constants
>         divisor 48
>         quantum\x1514
>         perturb\x10
>
>         reNum="\([0-9]*\)[a-zA-Z]*"
>         reStr="[0-9]*\([a-zA-Z]*\)"
>
>         # Bandwidth calculation
>         bwPrivateDL=`expr \( $bwDL : $reNum \) / 2``expr $bwDL : $reStr`
>         bwPublicDL=$bwPrivateDL
>
>         bwPrivateUL=`expr \( $bwUL : $reNum \) / 2``expr $bwUL : $reStr`
>         bwPublicUL=$bwPrivateUL
>
>         # Delete discuiplines for DL and UL devices
>         delete_qdisc
>
>         ifconfig $devUL txqueuelen 1000 2>/dev/null
>         ifconfig $devUL up 2>/dev/null
>
>         # Add discuiplines for DL device
>         tc qdisc add dev $devDL root handle 1: htb default 12
>
>         # Add classes for DL device
>         tc class add dev $devDL parent 1: classid 1:1 htb rate $bwDL ceil
> $bwDL quantum $quantum
>         tc class add dev $devDL parent 1:1 classid 1:11 htb prio 1 rate
> $bwPrivateDL ceil $bwDL quantum $quantum
>         tc class add dev $devDL parent 1:1 classid 1:12 htb prio 2 rate
> $bwPublicDL ceil $bwPublicDL quantum $quantum
>
>         tc qdisc add dev $devDL parent 1:11 handle 11: sfq divisor $divisor
> perturb $perturb
>         tc qdisc add dev $devDL parent 1:12 handle 12: sfq divisor $divisor
> perturb $perturb
>
>         tc filter add dev $devDL protocol all prio 1 parent 11: handle 11
> flow hash keys dst divisor $divisor baseclass 1:11
>         tc filter add dev $devDL protocol all prio 2 parent 12: handle 12
> flow hash keys dst divisor $divisor baseclass 1:12
>
>         # Add filters for DL device
>         if [ -s $filePrivate ]; then
>             for ip in `grep -v "#" $filePrivate`; do
>                 if [ `expr index $ip :` = 0 ]; then
>                     tc filter add dev $devDL protocol all prio 1 parent 1:
> u32 match ip dst $ip flowid 1:11
>                 else
>                     echo $ip
>                     tc filter add dev $devDL protocol all prio 1 parent 1:
> u32 match ip6 dst $ip flowid 1:11
>                 fi
>             done
>         fi
>
>         tc filter add dev $devDL protocol all prio 2 parent 1: u32 match ip
> dst 0/0 flowid 1:12
>         tc filter add dev $devDL protocol all prio 2 parent 1: u32 match ip6
> dst ::/0 flowid 1:12
>
>         # Add discuiplines for UL device
>         tc qdisc add dev $devUL root handle 2: htb default 22
>
>         # Add classes for UL device
>         tc class add dev $devUL parent 2: classid 2:2 htb rate $bwUL ceil
> $bwUL quantum $quantum
>         tc class add dev $devUL parent 2:2 classid 2:21 htb prio 1 rate
> $bwPrivateUL ceil $bwUL quantum $quantum
>         tc class add dev $devUL parent 2:2 classid 2:22 htb prio 2 rate
> $bwPublicUL ceil $bwPublicUL quantum $quantum
>
>         tc qdisc add dev $devUL parent 2:21 handle 21: sfq divisor $divisor
> perturb $perturb
>         tc qdisc add dev $devUL parent 2:22 handle 22: sfq divisor $divisor
> perturb $perturb
>
>         tc filter add dev $devUL protocol all prio 1 parent 21: handle 21
> flow hash keys src divisor $divisor baseclass 2:21
>         tc filter add dev $devUL protocol all prio 2 parent 22: handle 22
> flow hash keys src divisor $divisor baseclass 2:22
>
>         # Add filters for UL device
>         if [ -s $filePrivate ]; then
>             for ip in `grep -v "#" $filePrivate`; do
>                 if [ `expr index $ip :` = 0 ]; then
>                     tc filter add dev $devUL protocol all prio 1 parent 2:
> u32 match ip src $ip flowid 2:21
>                 else
>                     tc filter add dev $devUL protocol all prio 1 parent 2:
> u32 match ip6 src $ip flowid 2:21
>                 fi
>             done
>         fi
>
>         tc filter add dev $devUL protocol all prio 2 parent 2: u32 match ip
> src 0/0 flowid 2:22
>         tc filter add dev $devUL protocol all prio 2 parent 2: u32 match ip6
> src ::/0 flowid 2:22
>
>         # Add mirred redirect discuiplines for UL device
>         tc qdisc add dev $devDL ingress
>         tc filter add dev $devDL parent ffff: protocol all u32 match u32 0 0
> action mirred egress redirect dev $devUL
>
>         log_end_msg 0
>         ;;
>
>     stop)
>         log_daemon_msg "Stopping trafficshaper" "ok"
>
>         # Delete discuiplines for DL and UL devices
>         delete_qdisc
>
>         log_end_msg 0
>         ;;
>
>     restart|force-reload)
>         $0 stop
>         $0 start
>         ;;
>
>     *)
>         echo "Usage: trafficshaper [start|stop|restart|force-reload]" >&2
>         exit 3
>         ;;
> esac
>
> :
>
> And there is tc show output:
>
> # tc -s qdisc show dev eth0
>
> qdisc htb 1: root refcnt 6 r2q 10 default 12 direct_packets_stat 5
> direct_qlen 1000
>  Sent 147698795 bytes 958679 pkt (dropped 0, overlimits 43066 requeues 148)
>  backlog 0b 0p requeues 148
> qdisc sfq 11: parent 1:11 limit 127p quantum 1514b depth 127 divisor 2048
> perturb 10sec
>  Sent 81156975 bytes 527521 pkt (dropped 0, overlimits 0 requeues 0)
>  backlog 0b 0p requeues 0
> qdisc sfq 12: parent 1:12 limit 127p quantum 1514b depth 127 divisor 2048
> perturb 10sec
>  Sent 66541452 bytes 431152 pkt (dropped 0, overlimits 0 requeues 0)
>  backlog 0b 0p requeues 0
> qdisc ingress ffff: parent ffff:fff1 ----------------
>  Sent 2333918666 bytes 1999165 pkt (dropped 421, overlimits 0 requeues 0)
>  backlog 0b 0p requeues 0
>
> # tc -s class show dev eth0
>
> class htb 1:11 parent 1:1 leaf 11: prio 1 rate 30000Kbit ceil 60000Kbit
> burst 1593b cburst 1590b
>  Sent 82530637 bytes 547960 pkt (dropped 0, overlimits 0 requeues 0)
>  rate 0bit 0pps backlog 0b 0p requeues 0
>  lended: 521119 borrowed: 5867 giants: 0
>  tokens: 6097 ctokens: 3048
>
> class htb 1:1 root rate 60000Kbit ceil 60000Kbit burst 1590b cburst 1590b
>  Sent 150027823 bytes 987451 pkt (dropped 0, overlimits 0 requeues 0)
>  rate 0bit 0pps backlog 0b 0p requeues 0
>  lended: 5867 borrowed: 0 giants: 0
>  tokens: 3215 ctokens: 3215
>
> class htb 1:12 parent 1:1 leaf 12: prio 2 rate 30000Kbit ceil 30000Kbit
> burst 1593b cburst 1593b
>  Sent 67497186 bytes 439491 pkt (dropped 0, overlimits 0 requeues 0)
>  rate 0bit 0pps backlog 0b 0p requeues 0
>  lended: 437399 borrowed: 0 giants: 0
>  tokens: 6431 ctokens: 6431
>
> Is my script correct or I'm something missing?
>
> Thank's.
>
> --
> To unsubscribe from this list: send the line "unsubscribe lartc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Dave Täht

thttp://www.bufferbloat.net/projects/bloat/wiki/Upcoming_Talks

  reply	other threads:[~2015-01-25 21:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-25 20:27 Qdisc HTB root overlimits and requeues Дмитрий Шикуть
2015-01-25 21:48 ` Dave Taht [this message]
2015-01-26  5:59 ` Dzmitry Shykuts
2015-01-26  6:41 ` Dzmitry Shykuts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA93jw6UWYCKYbSQq3Qwnk5ZtPp6WLVW-fAX6KH8HDOVEQ3JVQ@mail.gmail.com \
    --to=dave.taht@gmail.com \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.