Thanks Eric! I've adapted this to the following:
ETH="eth1"
EST="est 1sec 4sec"
BUCKETS=64
RATE="100Mbit"
tc qd del dev $ETH root 2>/dev/null
tc qdisc add dev $ETH root handle 8000: $EST htb r2q 1000 default 8000
for i in $( seq 1 $BUCKETS ); do
BUCKET=$( printf %x $((i)) )
tc class add dev $ETH parent 8000: classid 8000:${BUCKET} ${EST} htb
rate ${RATE}
tc qdisc add dev $ETH parent 8000:${BUCKET} handle ${BUCKET}: $EST
fq_codel
done
tc filter add dev $ETH parent 8000: handle 7000 protocol ip flow hash keys
src,dst,proto-src,proto-dst baseclass 8000:1 divisor ${BUCKETS}
This seems to deliver the behaviour I'm looking for - each flow is
effectively rate limited to 100Mbit/s, and multiple flows between the same
src and dst can achieve this rate (unless they're unlucky and fall into the
same bucket, which is not too bad). Have I made any silly mistakes in there?
The final thing I'm struggling to work out is how to limit this rule to a
single service. Ideally the rate limiting should only apply to TCP/8081. It
seems you cannot combine different filter types (i.e. the u32 match + the
flow match). Any suggestions?
Apologies for going OT on the list... I hope this topic is useful to others
Googling for it in the future.
Thanks,
Sam
On 9 July 2013 18:13, Eric Dumazet <eric.duma...@gmail.com> wrote:
> On Tue, 2013-07-09 at 16:58 +0100, Sam Crawford wrote:
> > Thanks very much! One quick kernel upgrade later (to add fq_codel
> > support) and that has definitely helped. I'll run a larger set of
> > tests and report back.
> >
> >
> > One final question: I understand that this applies a 100Mbit aggregate
> > shaper to the specified destination(s). I'd like to instead apply this
> > shaper on a per-destination or per-flow basis, but without specifying
> > each individual destination (i.e. so that 10x 100M clients could still
> > saturate the 1G link). Do you know if this is possible?
>
> If you are interested by a qdisc setup you could adapt the following to
> your needs. It uses hashing so you could potentially have two flows
> sharing a single bucket.
>
> ---------------------------------------------
> #!/bin/bash
>
> ETH=eth0
>
> setup_htb() {
> FROM=$1
> TO=$2
> RATE=$3
>
> for i in $( seq $FROM $TO ); do
> slot=$( printf %x $((i)) )
>
> echo class add dev $ETH parent 8000: classid 8000:$slot htb rate
> ${RATE}
> echo qdisc add dev $ETH parent 8000:$slot handle $slot: codel
> done
> }
>
> tc qdisc del dev $ETH root 2>/dev/null
>
> (
> echo qdisc add dev $ETH root handle 8000: est 1sec 4sec htb r2q 100
> default 10000
> setup_htb 1 1024 100Mbit
> echo filter add dev $ETH parent 8000: handle 2 pref 20 flow hash keys
> src,dst,proto-src,proto-dst baseclass 8000:1 divisor 1024
> ) | tc -b
>
>
>
>
>
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit
http://communities.intel.com/community/wired