在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下
$ T* \4 y1 T, F; V0 W The risk of congestion collapse on the Internet is becoming a reality1 e6 y- O* w" h
given the increasing number
' }" t1 G& C. m3 @ of audio/video applications that use UDP as their main transport
$ q- M* f( k$ v$ jprotocol. Unlike TCP, these
i" S- C- ]: z4 H! j5 I traffic do not respond to congestion signal; i.e., a packet loss. As a
M/ c% m7 U$ P* y; b' vresult, audio/video 3 g! l0 Y. x+ ^& E' O0 T
applications may take an unfair share of the network bandwidth and% c8 T! n& `; r' e9 E
also cause persistent 7 ^! P3 |5 S6 Y) K* {$ o
congestion. To avoid congestion collapse, the IETF has proposed that- L4 W7 ?' Z2 B; ?. ~' b( S) k
audio/video applications
0 \- i9 e; d9 N9 H) O2 H! ? use equation based congestion control (see Lecture‐7 and the reference2 K) Q( `( k+ A* b8 y( k7 @
given on the next
& y, x! D# g* O( [4 k; \ page).
C0 Y/ n$ H: ]5 w, w) n, T y' U* Z1 b- ^ In this assignment, you will simulate n1 N, j! q! W- a. R7 O
sources that uses/ J4 A! y. p5 e& ^/ a" G
equation based congestion control to
& U# K9 q1 `, o$ U8 e, K set their transmission rate. From your simulation, you will determine
9 c, W* y( }" G l9 ^whether equation based
( Y! i5 E" r0 D) ?4 h Q# [ congestion
0 R! S" r* h% T- ~8 v! ycontrol is effective in reducing packet loss, and hence congestion.
+ I, \7 v9 w3 G" M, n, `$ {& S9 c7 d
4 `- a1 a {: `4 k9 w The above network can then be simulated as follows: 1 {6 T7 S7 T, l9 [+ @
Initialization 4 f w! o; r) A
Set the router’s queue size to N, meaning it can hold up to N packets. ' s: o2 R: B1 \9 o2 U
For each sender, set an initial transmission rate, and determine the
8 g2 c; e, H) Z; x: r7 e; P( ztime when the first packet is
7 q- }( q% _, z5 f& K( t to be generated.
5 q) E6 c2 f9 ?: I' N Body , Y/ e! h, j C6 ~
FOR t=1 to SIM_TIME DO
; f* s& @1 p) Z# o2 [ w { v9 J; T1 ?$ b( ?
1. IF the router’s queue is not empty then dequeue a packet, and
, u* l0 j8 Y" _, P- a+ kenqueue that packet in
& r9 C/ V$ O G. G2 j- @( c the corresponding receiver’s queue. 1 }) p& Q& @. H& U# x7 H ]# q5 d
2. IF a sender has a packet to send THEN
! D& J9 T9 ?7 b- U) z: F' l. L ‐ Check if the router’s queue is full. If not, enqueue the sender’s
1 }+ }/ V$ d& }7 ppacket. Otherwise,
+ X* Y+ ?9 Q6 U% w discard the packet.
4 W! ` \2 X4 A* @5 V' c- m+ y# Q 3. Determine whether any packet loss rate messages are generated by
/ P# R' e6 X- r; H1 o( Mreceivers. If yes,
! T/ d3 d; F9 h* C8 }3 d then re‐compute the sender’s transmission rate. Determine the new time X2 G. [+ V" b! \1 O4 J
when the * J: U/ P' }. \' }4 F6 o- j# u" T
next packet will be generated. I.e, t+k, where k is the time interval
( ` Y; s& N+ zuntil the next packet ; }: o) q& [0 _5 S; o+ v! S7 ]- P
arrives. 0 x( @, s# n2 x: f" F
4. Collect all required statistics. j2 U( H9 S9 |5 M
} % l+ ]: `- j. y2 R. ?
In your simulation, collect the (a) queue length over time, (b)% Q0 ~. x2 n2 k
average queue length, (c) average
& N3 J) u' ^/ X end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the+ @# r' @5 k" O8 J4 p, V
effect of the following - `2 f9 G1 s/ o# f
factors: (i) increasing source and receiver pairs, (ii) varying N
( J z/ c- P2 K: w: uvalues, (iii) different packet loss
1 P4 x; h: g6 R3 y' j; h- r reporting periods, (iv) loss calculation methods, (v) load p, (vi)
4 T3 V8 O4 S1 i4 p8 w7 \7 brouter’s transmission rate;
4 z$ F0 ^$ X U instead of one packet per‐tic, try k packets, and (vii) z
) F$ K$ }' p9 h9 Vnumber of new flows, V* F$ M! K2 v- Y, U+ {4 K* P
arriving at time t .
) p: P, u/ x V# q' @7 E8 m # D$ p2 R- ^; q+ F/ d0 L4 n4 |% c% `
% Q- N* z; w+ F
# O8 P n3 K$ R1 u1 o7 P) q Do with sources
A0 V( ?! D; }$ [' Fusing a token/leaky bucket to control their transmission rate. + o4 Q5 {; l' V2 {
Another difference is that each source has an application that" g( y7 C! j' Y7 ~, P0 F7 J+ S# |
generates bursty traffic, where
: D. O) Y! E. w2 c4 }8 P$ ~ multiple packets arrive in consecutive time intervals. , F4 B$ _; S! r. T% y7 a
To generate bursty traffic, use the following method:
( P7 N3 V. _8 c) S* X6 u! } 6 ]# y8 [0 ~& P* M
* z1 m+ Q2 \/ v6 `& ?0 U# @: m
In the diagram above, an application generates a packet when it is in
) _6 K$ H+ R& D1 a& wthe ON state. With 1 i! G6 S" `" ^) q5 `
probability k, it will transition to the OFF state where it will remain idle. In
3 q# y0 I3 \9 t8 X l2 m7 d* t3 l$ [this state, it has ( z/ f* B. Q9 A& s
probability z of moving back to the ON state. ) X) Y8 S; p ?8 k' Q
The pseudo‐code is as follows:
2 C; F- @0 |. @2 n0 c 1. Start at a random state: ON/OFF. ! N* c: o9 _6 n G
2. At every simulation tic, do 1 k0 U* _# h8 p; N3 e5 ]
a. Select a random number R in 0<= R <=1.
7 b9 ?( C# M# w2 t, m; d2 P b. If in state=ON
" t( P5 b* K# g4 q1 Q6 GAND R>=k, set state=OFF.
8 Z; V7 ^+ r/ K9 Q W( N c. If in state=OFF AND R>z, set state=ON. 5 D1 P0 I! h$ Y t8 e G
d. If state equals ON, generate a packet. # _! g$ i; ]! c$ j+ w/ J0 K
Design an algorithm to control the token/leaky‐bucket rate of each3 _2 w# M7 p5 U
source (or all sources ) S: [8 L) k( a
simultaneously) such that congestion does not happen. Note, you must
0 ^# V; L; s: D4 iexperiment with - E' V/ p: H# J; t
different k% P- c# z! r8 E+ \3 S. {- }
and z9 _# A' j7 K9 G" Z# o) Y
values and determine
& M: O1 @+ n% V! N$ J2 ftheir impact on congestion. 5 K( r# Z8 l4 @8 G
Reference $ x2 d6 w+ p, A* j
S. Floyd, M. Handley, J. Padhye,+ `5 g# f* P+ Q1 q2 o3 G
and J. Widmer (2000) Equation-based Congestion Control for Unicast + p" ]4 m3 \% p/ _$ W. N9 M
Applications, ACM SIGCOMM, May,9 n0 ^7 R B7 `
2000.
3 ], }+ g+ p2 U: j
# W, M# p3 |$ A+ D4 `* l
; E- e6 g$ |# E& y) T
|