[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

leaky token bucket shaper



Hello,

I want to implement a leaky token bucket shaper. I'm using this code:

---------------------------------------------------------------------
#!/bin/sh

# Simple script for leaky token bucket shaper

IPROUTE=/usr/src/iproute2
TC=$IPROUTE/tc/tc
IP=$IPROUTE/ip/ip
DEV="dev eth1"
RHO=1.7Mbit
MTU=1.5kB
BUCKETSIZE=1.1kB

# Wipe out existing qdiscs
$TC qdisc del $DEV root

# Add the token bucket filter 
$TC qdisc add $DEV handle 1:0 root tbf rate $RHO burst $MTU limit
$BUCKETSIZE
---------------------------------------------------------------------
I use netperf to test it and observe that packets get shaped but dropped.
See:

# netperf -l 2 -H myHost -t UDP_STREAM -- -m 1024
UDP UNIDIRECTIONAL SEND TEST to diana : interval
Socket  Message  Elapsed      Messages                
Size    Size     Time         Okay Errors   Throughput
bytes   bytes    secs            #      #   10^6bits/sec

 65535    1024   1.99        83799      0     344.51
 65535           1.99          200              0.82

Its says that only 200 messages went through. The throughput numbers also 
throw me off.

How can I change my script to obtain the result desired (ie a leaky token
bucket filter)? Thanks.

-- Umair Hoodbhoy
hoodbu@rpi.edu