在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 & y; l. `. w4 Z
The risk of congestion collapse on the Internet is becoming a reality
4 f: n8 U- ~" V! \& l! X" Ggiven the increasing number 1 _+ d0 I; ?# X
of audio/video applications that use UDP as their main transport4 s* ^: p' z0 i7 O. g
protocol. Unlike TCP, these
- R$ m8 X2 ], V7 d1 ~7 ^ traffic do not respond to congestion signal; i.e., a packet loss. As a9 P8 B: u2 \ @# X' O
result, audio/video % z7 g+ F) E8 A, a
applications may take an unfair share of the network bandwidth and/ b1 ^7 o9 }1 y4 s% |1 \: D
also cause persistent 6 Q" E( F/ ~3 D2 ~ a6 K
congestion. To avoid congestion collapse, the IETF has proposed that- U3 v0 V/ B" p8 J- q5 U/ A
audio/video applications / j5 t) [$ c' L, B
use equation based congestion control (see Lecture‐7 and the reference# ]) P, d: E) u+ D
given on the next 5 U) \! Q3 e, o. _1 _/ o( B
page).
3 p" X7 N- z/ i1 b7 S/ j6 y0 O In this assignment, you will simulate n
6 G7 [% T( s& n4 j& {+ x+ G4 o; Wsources that uses/ S7 p$ m. `- ?4 o$ Q
equation based congestion control to 2 T5 |; e& k, n1 q6 r; \& _" ]. J
set their transmission rate. From your simulation, you will determine- J% r# ^0 b( s6 H# O! Q
whether equation based
" D4 x- } h* `8 U8 U# X congestion
: Y! V3 W' C: a y$ _' T ~control is effective in reducing packet loss, and hence congestion. " S+ ]$ w2 S1 R4 b
( A i5 t9 Y% E/ q: @ The above network can then be simulated as follows: ; }. G% @: ~1 K" O1 _0 W& \
Initialization
9 q2 ] b- q6 } Set the router’s queue size to N, meaning it can hold up to N packets. % B2 }6 j$ i/ i+ V( q
For each sender, set an initial transmission rate, and determine the6 e: ?( s( J; g! n2 p! i2 v
time when the first packet is
; s( E) }, T9 h& {. y/ l to be generated.
6 Z, q/ w# P: r1 L Body 5 W! r ?+ y c( v# U& m
FOR t=1 to SIM_TIME DO
0 h, [- ^' `8 l { $ H) @/ b' |" d' K! c1 W, D
1. IF the router’s queue is not empty then dequeue a packet, and: U% N0 u* d. k' P7 m2 t
enqueue that packet in
% T, k6 T6 f; O7 P the corresponding receiver’s queue.
, f! l% R5 B; G+ Q. k$ g 2. IF a sender has a packet to send THEN
& P8 U& x6 ], l ‐ Check if the router’s queue is full. If not, enqueue the sender’s
) r: t" y! R; A( ]5 o4 Z6 M' W& vpacket. Otherwise,
" F/ i" T$ I* O/ R6 h/ A- } discard the packet.
( `! [; E+ }- \8 ?; G( `9 m 3. Determine whether any packet loss rate messages are generated by9 Y8 d4 ]7 J8 C2 J
receivers. If yes, 8 O1 w+ X5 l% s& R
then re‐compute the sender’s transmission rate. Determine the new time; A* R. p0 R- H+ r3 i
when the
# L9 z5 G6 k6 b4 ^ next packet will be generated. I.e, t+k, where k is the time interval# I+ B, c- ?3 S j/ o2 n# s
until the next packet
/ Z d$ e7 ]* }' E2 J# d arrives.
2 _( x! X, a6 W" a3 T9 L, T& Z 4. Collect all required statistics. + R0 B9 a5 R2 c4 F: k' z+ i
} ! R# R* G) K4 B$ v2 j
In your simulation, collect the (a) queue length over time, (b)
# U2 l. s' ?8 z4 @average queue length, (c) average . Z* z h3 [1 @4 e/ h. `( |" ^1 a
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the' L( X5 ?8 m: B8 y. `' c: X( F4 d6 _
effect of the following 3 ?$ ~; w0 p0 s7 q4 U5 L/ M
factors: (i) increasing source and receiver pairs, (ii) varying N
0 r% N: v8 L N; P2 P: Dvalues, (iii) different packet loss
% ?4 {* ?; b# |; v! [+ H# x6 \# b reporting periods, (iv) loss calculation methods, (v) load p, (vi). h. Y0 `9 A+ y, i: t+ G! b
router’s transmission rate; 5 P- ]9 L" o1 ~" i& H
instead of one packet per‐tic, try k packets, and (vii) z. H8 ^. S& i, V' l, v' t0 g
number of new flows: i$ K: Z/ ?, t. l
arriving at time t . 3 `4 q5 j/ k* |. n8 j. v% ^) N
5 @/ l/ B$ \+ u0 N2 d" ^
' J& p" b0 j: A6 }# l. i 0 r) g8 U5 @8 w
Do with sources
- g5 r0 E/ S; G3 S4 V6 ?using a token/leaky bucket to control their transmission rate.
" I/ k1 P6 y; Q, F Another difference is that each source has an application that
2 q3 C9 X. o ?0 \0 I( n- l$ W6 I: ogenerates bursty traffic, where
) R4 H* }4 d) p3 v+ S multiple packets arrive in consecutive time intervals. - m% Z, G9 v1 ^! C( g& m( R
To generate bursty traffic, use the following method:
1 n- g% l9 S% p+ c: L& s& u
2 r6 \( x) c9 Y+ h7 D: o ( n7 p; m" T2 o/ I% k" q0 v
In the diagram above, an application generates a packet when it is in$ y$ j, d$ |4 ^+ R1 U2 a
the ON state. With E: m; ~' b4 ?
probability k, it will transition to the OFF state where it will remain idle. In |, `& _8 f( B9 X! i
this state, it has
1 s4 {' ]5 D* h3 y probability z of moving back to the ON state. & z# N, W# e5 Q5 j0 g' ?
The pseudo‐code is as follows: & _0 t8 T& b) M& J9 X, E
1. Start at a random state: ON/OFF. 5 k" F; e% x' V e
2. At every simulation tic, do
9 i2 @( @; E, X5 o8 A( s9 _ a. Select a random number R in 0<= R <=1.
! t' o/ ~5 G8 P; ? b. If in state=ON) H' `+ [# d) W
AND R>=k, set state=OFF. $ A) p# R2 `1 V2 \4 b
c. If in state=OFF AND R>z, set state=ON.
. V9 z) c/ u7 k3 f! r d. If state equals ON, generate a packet. / L- z! h8 x* a4 S, Z5 {
Design an algorithm to control the token/leaky‐bucket rate of each6 _3 ~6 k) \: b9 s% y/ I' z
source (or all sources + U0 g! X) u. ?) F m) D" C4 U# E- }7 [
simultaneously) such that congestion does not happen. Note, you must
+ c; a; T" @4 T8 Q3 H# {experiment with % S+ r* Q _3 B+ e( Y7 S- F
different k
1 q5 D, {1 e( Y: Jand z
2 _: A# u3 l8 ?' I: V7 xvalues and determine4 `' } i6 h7 ?. M$ i# M$ u9 }
their impact on congestion. : a( K" C5 b$ X) K
Reference
% Q- H; M2 b: H S. Floyd, M. Handley, J. Padhye,& L0 G) U. `& X2 U( [6 o
and J. Widmer (2000) Equation-based Congestion Control for Unicast
# H. @% _, d& E- A! m Applications, ACM SIGCOMM, May,
; c1 P$ U5 ^+ ?- d8 N& N, W3 p2000.
0 X0 J; K5 I( f# W8 Q' F * v3 E! p+ G: [5 X1 U3 F% R# E" x
1 F9 F9 [, r1 }9 s& x" R6 ]# L8 S
|