在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 : r6 s5 t; {7 h3 z" k& X. v8 z7 K8 F
The risk of congestion collapse on the Internet is becoming a reality
7 \! a( y- {" a1 a% M1 n# z8 I# agiven the increasing number
7 V+ d0 R+ r- a of audio/video applications that use UDP as their main transport
( z! G3 n, h8 ~: T" d( A7 hprotocol. Unlike TCP, these 1 C* ]6 U% j5 E( S1 i
traffic do not respond to congestion signal; i.e., a packet loss. As a
9 e1 F6 P. w, O* K# F" A2 c# Dresult, audio/video / y# d6 Z9 `9 m0 t) i. n/ y4 y, v
applications may take an unfair share of the network bandwidth and/ X: O& R' Z V1 Q- n: |
also cause persistent
$ y3 i& Q2 }) d1 _* g congestion. To avoid congestion collapse, the IETF has proposed that
; r, _8 T( E) N! i" j. B$ x3 paudio/video applications
( s9 f/ z: i& T! C) @ use equation based congestion control (see Lecture‐7 and the reference
' l0 ~( R" [0 sgiven on the next 2 O+ }% B' V# ?( P$ ^" U
page). ) g2 \4 Q+ | j: c) f
In this assignment, you will simulate n5 k" n3 \" N+ A0 ]
sources that uses: @0 i1 Z' b1 O9 o) N) I: [, y
equation based congestion control to ; ]' G! M: u; ~# P+ R% x! o
set their transmission rate. From your simulation, you will determine
, [4 N; p. ]- w; @* rwhether equation based ( D+ \, G$ y* {( z, ?/ E
congestion
/ K& z8 c" o4 D; c) P; [control is effective in reducing packet loss, and hence congestion. . S- Z. _) V! r5 O0 r! S3 p& z
T6 b) z4 r* P' w The above network can then be simulated as follows:
5 `5 A. W) u2 I4 ]# o% y: x9 j Initialization
2 S" A8 u0 K7 T- V Set the router’s queue size to N, meaning it can hold up to N packets. / }& z4 G. w- p5 s. G
For each sender, set an initial transmission rate, and determine the
* f, E; G! @8 }5 dtime when the first packet is $ [% q% L4 a# U# A9 ?8 x N
to be generated.
5 y0 Z1 ]4 Z1 r% `2 K Body
& W( x+ ]8 |; ~* w$ ^ FOR t=1 to SIM_TIME DO ) ]0 i4 r6 w/ @$ t# W7 t2 @3 S! z
{
& L, B. ~4 R# {. [ 1. IF the router’s queue is not empty then dequeue a packet, and! j; }: N" d# o, j! k% i+ N
enqueue that packet in 5 u# ]6 }) B+ k* b. ?+ \ K+ D5 N
the corresponding receiver’s queue. " E* d$ l0 Q3 S/ y Y! `
2. IF a sender has a packet to send THEN & X1 `3 D9 N8 f- b7 f
‐ Check if the router’s queue is full. If not, enqueue the sender’s( i. f% b& L: H: k/ j
packet. Otherwise,
2 D8 a$ q, F+ ?5 Z/ l discard the packet. 6 I: F! ?6 ]/ v/ _
3. Determine whether any packet loss rate messages are generated by
c5 i( b2 K, x2 Wreceivers. If yes, {& o! r# m6 s8 Y
then re‐compute the sender’s transmission rate. Determine the new time
/ t: X" a6 D5 ~) b0 owhen the ! K G5 ]8 \1 i: B
next packet will be generated. I.e, t+k, where k is the time interval0 e+ P2 ~( p, B; e4 a$ Z
until the next packet
+ B4 o5 K/ y% V arrives. - _, G2 O; [" l' t9 Y6 p
4. Collect all required statistics. 9 j' g( R; g9 J
}
$ Y' H) B+ P/ ^$ W In your simulation, collect the (a) queue length over time, (b). a+ `! _! {4 K/ T: F
average queue length, (c) average
7 P4 L$ {3 e: o' l end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the2 l# n( ^. p5 V d
effect of the following
% e: ]9 v. r% {" n& k factors: (i) increasing source and receiver pairs, (ii) varying N
5 R% V; V* D( w1 a! Lvalues, (iii) different packet loss 0 C, k. b3 B* J0 ~0 N" ?
reporting periods, (iv) loss calculation methods, (v) load p, (vi)
- k6 k$ j0 |& |5 Q. Grouter’s transmission rate;
, b2 x/ C' G/ ?( q s! R instead of one packet per‐tic, try k packets, and (vii) z. p3 B9 u. y* P* [9 I1 K( h
number of new flows
0 W3 v( t7 n+ c" Y2 Harriving at time t . 6 c% @$ `! E5 o& |% m! Y# y
5 O" Q2 }' t3 V# U5 n2 u
1 B% O9 i) g; g+ H5 j
* f2 O0 q3 O) S' V: R# B Do with sources
( S6 Q, ~ B9 [4 M' G& N/ D0 E0 r8 rusing a token/leaky bucket to control their transmission rate. & g& I! W$ H% i( B9 T$ F. h
Another difference is that each source has an application that' ^: O) M, J% u6 h
generates bursty traffic, where 5 B2 j% {6 _. r: E, h. X* w) c
multiple packets arrive in consecutive time intervals.
5 P$ Q8 |/ g/ {. m* y: k! } To generate bursty traffic, use the following method: / Y j. Z) f6 n, i
6 x% p' M! ?, A5 U2 _
; | \8 `+ V$ i/ s$ C2 O& f In the diagram above, an application generates a packet when it is in2 A: s$ V. x* q& _8 l+ l
the ON state. With 3 t' ?5 x$ |8 ^: K" @ L3 c/ P( ?
probability k, it will transition to the OFF state where it will remain idle. In( x# q4 x: n9 R" B
this state, it has
' K; r8 W: ~: }4 @3 O0 |% L" f; C probability z of moving back to the ON state. - y* r/ B: X6 _
The pseudo‐code is as follows:
" D7 K ?2 a, v8 |6 D1 W 1. Start at a random state: ON/OFF.
N2 F5 p/ c+ x 2. At every simulation tic, do
% k" f. | z- v9 e7 k- N- ?3 p a. Select a random number R in 0<= R <=1. , k. v7 v" c+ E8 b# F1 h! P0 w
b. If in state=ON
. f. |5 v5 A; K. jAND R>=k, set state=OFF. ) C7 ]. q3 }+ g* J; Y2 v
c. If in state=OFF AND R>z, set state=ON. 9 X* }8 m. f. K+ G9 r
d. If state equals ON, generate a packet.
0 `( L8 g5 J- f Design an algorithm to control the token/leaky‐bucket rate of each
+ j8 x! b2 r Y5 X* j7 ]source (or all sources
3 Z, {, I4 A1 s" C simultaneously) such that congestion does not happen. Note, you must7 z2 j$ A; i( p% _! H
experiment with & A: O7 j* t: H3 s4 z
different k
# I: w8 \$ H. Xand z/ g" m/ e9 `, Z. F2 V
values and determine
: D1 t+ @ c2 [! Z8 z3 l. [their impact on congestion. 2 V/ U- h7 c+ g7 e/ r: L( Z( z
Reference 4 B0 v1 C5 N) _$ r+ {
S. Floyd, M. Handley, J. Padhye,
! L) X9 B) O9 q; pand J. Widmer (2000) Equation-based Congestion Control for Unicast 5 W" g- _7 P' x3 P7 ?
Applications, ACM SIGCOMM, May,6 U: F" Y# I; \( H) {) X. Q* U7 {
2000.
! W9 j2 e1 F. k* l6 J8 r 8 ~" D6 M' z! A }) I x' s* @% X7 ]
) `! t( ~4 s) |" q' C3 K" T
|