在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 & Q8 d" ]4 D. ?7 c
The risk of congestion collapse on the Internet is becoming a reality5 | O" E7 ~, V1 X4 e/ q
given the increasing number 4 x, Q6 F* J9 s
of audio/video applications that use UDP as their main transport
( g$ v; A" ^) B& rprotocol. Unlike TCP, these
* R( j0 \5 F Y' L0 p; g traffic do not respond to congestion signal; i.e., a packet loss. As a) `) n, y/ ]; o
result, audio/video & L' z7 h" p6 ^
applications may take an unfair share of the network bandwidth and
) {1 f/ ~& l; falso cause persistent ( V: q9 r+ Q0 O# N+ r/ d# y4 x
congestion. To avoid congestion collapse, the IETF has proposed that3 f7 _- X2 Y0 [9 y& h
audio/video applications ; {/ ^! D- {; P6 S) _3 Z3 n
use equation based congestion control (see Lecture‐7 and the reference
( V( [/ a8 | O, t% I3 }# Hgiven on the next
4 G! O9 O) P* d7 r8 a; p6 S page). w8 ~, ^" T: o3 a6 o0 C+ r
In this assignment, you will simulate n7 h i6 I+ p; Q
sources that uses
. g. G; ~( R7 A4 Sequation based congestion control to 7 c0 p7 I* t k0 \2 F* R$ z9 [( ~
set their transmission rate. From your simulation, you will determine- n. C) w- M9 T
whether equation based
4 g) g/ {7 P( }% L4 u" i }- G. B5 [ congestion
& ~2 E: ^. E9 X) [& i& hcontrol is effective in reducing packet loss, and hence congestion.
% D/ D; O8 I, }7 @: [
" Y; k/ O7 h; i/ c" Z. X* }
The above network can then be simulated as follows: " {3 X7 I3 S% @
Initialization
4 g$ Q$ v2 I% {9 y3 A% b& Z Set the router’s queue size to N, meaning it can hold up to N packets.
+ V. Q" X" R% a For each sender, set an initial transmission rate, and determine the+ N2 M6 K' _, ^7 E% C9 h q3 m0 `
time when the first packet is U' O* e% s# }
to be generated.
; |3 I( H) D/ H Body F3 g7 G8 c! Y$ P
FOR t=1 to SIM_TIME DO
% ]) ]7 z+ U' |- a% c$ J {
- R$ A! R, |( a0 }/ Y 1. IF the router’s queue is not empty then dequeue a packet, and( |% h' f5 o" e" t6 o; i; T
enqueue that packet in D, a8 C- y1 V* c
the corresponding receiver’s queue. % K W6 ]% ~6 `! a. C
2. IF a sender has a packet to send THEN
1 N3 I& _5 D/ }; C1 h1 l ‐ Check if the router’s queue is full. If not, enqueue the sender’s
) t5 U* Y! [- U2 q6 e Z0 ^- q0 Tpacket. Otherwise, 2 F C% H2 _6 t2 }; r
discard the packet.
$ i! P* w# k& E2 S 3. Determine whether any packet loss rate messages are generated by
$ S6 y5 J" Y, o2 Zreceivers. If yes, ; K7 F6 w9 h1 ~- p% E2 F* k
then re‐compute the sender’s transmission rate. Determine the new time1 ^6 l% \% u6 X/ [
when the ; W. R8 s. e @
next packet will be generated. I.e, t+k, where k is the time interval, w5 \ y& t' P0 Y
until the next packet
& F# v% e" [! `- H# w4 T arrives. - w/ p, ^( B' } e+ [
4. Collect all required statistics.
" r7 S6 P- [1 \# q8 K" [, r }
9 d1 o/ v! }' y+ y2 f In your simulation, collect the (a) queue length over time, (b)5 J( k3 j+ P! @
average queue length, (c) average 8 C7 l0 i4 t5 m( v7 i
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
. L8 {/ S6 F1 x; W- e1 Ueffect of the following & V3 _# ^: D7 y7 A1 @
factors: (i) increasing source and receiver pairs, (ii) varying N" C; Q" M3 y6 f# t q
values, (iii) different packet loss
, |! _+ F. ^* E4 m reporting periods, (iv) loss calculation methods, (v) load p, (vi)# R) V- [6 d L: Z) K, J7 Z2 }
router’s transmission rate; " `# y) k3 l w
instead of one packet per‐tic, try k packets, and (vii) z. ]- m$ O; M* w3 z+ ~: p3 Y: p
number of new flows7 D2 F/ _5 r! r3 k
arriving at time t . : v% \1 T1 }- t( U4 |
- j6 O) h; [! }+ k2 I
* f8 B% {0 `# z- n$ ]
' z1 d. q6 h& e( V/ |& b/ d: @ Do with sources
8 H1 B4 x6 O2 ` ousing a token/leaky bucket to control their transmission rate.
6 _6 p8 H* u9 C: V' A: G3 e: H' U) c$ s/ ` Another difference is that each source has an application that
# E# U+ @. a; _; N5 F r, @generates bursty traffic, where
2 t- a% g' {) F8 X; D1 | multiple packets arrive in consecutive time intervals.
& `6 p" F) b1 O# s* N6 ] To generate bursty traffic, use the following method:
# w$ `: }9 J, O. P0 Q
a/ T" z9 F3 t; O2 I: b) O/ _
$ c' W e3 i( {) X4 \& ~ In the diagram above, an application generates a packet when it is in' d* a/ C. K% T) Y. d
the ON state. With
. ^' A8 [; ^9 V! h# T, J" {: M, r probability k, it will transition to the OFF state where it will remain idle. In* S9 C7 T" l, l; ~
this state, it has
0 s6 p, l* G$ s" x probability z of moving back to the ON state.
( E1 v& M" j/ j& V- V0 l The pseudo‐code is as follows: ! k* u! M- g9 Q" W e% `
1. Start at a random state: ON/OFF.
P B) J& T" q4 L 2. At every simulation tic, do 3 F7 `7 j* I v( q5 W$ z! H# {: K. e
a. Select a random number R in 0<= R <=1. ! H2 L" y' L7 k" B* F
b. If in state=ON
* ]8 }5 o/ I% kAND R>=k, set state=OFF.
6 Z! G' a& b0 x# P8 J- U c. If in state=OFF AND R>z, set state=ON.
* u6 V5 P9 w6 a" J" X b5 o d. If state equals ON, generate a packet. ; A( l7 |) O3 y2 @4 R
Design an algorithm to control the token/leaky‐bucket rate of each& d2 b: ]7 I& C* A/ l* i
source (or all sources ! P; R: Z! ~$ p% ^- ?0 v4 C. O
simultaneously) such that congestion does not happen. Note, you must- y9 d* g( _& t
experiment with $ |; R) F* X3 ~; a
different k, B7 e# C5 D" @* q" M+ ~7 X
and z6 L) `! j( ?7 v$ h& m1 t% R
values and determine* K- x W3 F* A; t7 v
their impact on congestion. 0 Y+ J) x# {) ?4 i6 z, q8 N
Reference
& ]' w6 p( F) N% R% j S. Floyd, M. Handley, J. Padhye,
/ Y1 G1 w' r# L/ N% Jand J. Widmer (2000) Equation-based Congestion Control for Unicast & d2 W1 g& X4 y8 J& X
Applications, ACM SIGCOMM, May,4 @: s& K9 K$ W3 B6 Y
2000.
5 k2 H" O. t, {4 z& L" |: n) R 0 c" [0 {1 [/ d9 j3 q' h8 A$ _2 U) [) Q9 a+ j
2 ~4 O( z2 }$ G- P9 \0 G
|