在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 $ K$ e4 a4 i* l2 S; n7 y3 _
The risk of congestion collapse on the Internet is becoming a reality
! ~- ~7 m% Y, }( S- d$ Bgiven the increasing number
! H: Y& T1 k- S- u% R of audio/video applications that use UDP as their main transport
& Y! _$ [) I! qprotocol. Unlike TCP, these 3 m# q! m+ k/ ]
traffic do not respond to congestion signal; i.e., a packet loss. As a
c; Y; D7 v, f7 [; j/ zresult, audio/video * @* ?7 I& E% O, J5 c& G0 S
applications may take an unfair share of the network bandwidth and. s: T7 T0 H3 ?% l' n9 q( [
also cause persistent ' c' j5 D I. N/ O3 W
congestion. To avoid congestion collapse, the IETF has proposed that9 d3 o4 e* c; e4 O% q; H
audio/video applications
, `7 Q9 \5 R' v% y" W: r) | use equation based congestion control (see Lecture‐7 and the reference
( p$ w7 C+ R2 n6 s' \' X1 xgiven on the next
/ G9 \0 |; U& O7 \ page).
: {+ R e' p# d1 L! M. F In this assignment, you will simulate n: ?/ L& ~7 \" V2 C
sources that uses
8 q2 p" n1 t6 `( Oequation based congestion control to ) u: s9 Q- h7 R3 l
set their transmission rate. From your simulation, you will determine
+ \- U" d- R0 y: |) C. qwhether equation based D+ O7 g$ T4 @* y% I
congestion
2 a/ b* i% A' p% P* u: h- Qcontrol is effective in reducing packet loss, and hence congestion.
$ n. H/ |6 v' l( I5 y
8 Z2 D7 ?' Q5 f- d% J& N, y8 K: i The above network can then be simulated as follows: % J$ Y7 J9 u3 F2 P
Initialization
5 E, [7 b! F: O Set the router’s queue size to N, meaning it can hold up to N packets.
# \/ h% V8 j% f- G For each sender, set an initial transmission rate, and determine the' L( |$ ]' ^# V Y! }0 \
time when the first packet is * S6 E4 D6 L1 w/ j# G* C7 j
to be generated.
) K: p t# n+ |! b3 L- n Body
! q* o: {4 \9 e5 ~" j5 }/ L# y: M FOR t=1 to SIM_TIME DO
" Y6 m4 S. o, [/ {% E( J2 Z4 Q {
" q8 x, I9 l8 B- P, W/ S/ n 1. IF the router’s queue is not empty then dequeue a packet, and
: R; ?. P, d; P* u0 Kenqueue that packet in # M! y2 s& v7 {- r
the corresponding receiver’s queue. 3 x) I, C* m: H8 e9 w' W
2. IF a sender has a packet to send THEN
1 A0 v* R5 ]( {. q9 a! O ‐ Check if the router’s queue is full. If not, enqueue the sender’s
7 m) b3 x5 v1 Hpacket. Otherwise, + | P9 e9 o: ]
discard the packet. - [# `* `6 J6 S5 N+ R1 h
3. Determine whether any packet loss rate messages are generated by
& s" L2 {. y" E( N. mreceivers. If yes, ; P+ }& q1 l# W# g* g* k( u3 U) v/ S
then re‐compute the sender’s transmission rate. Determine the new time/ u( d! x* a2 I$ F5 m. J+ x
when the $ H. W8 n9 O) g3 z
next packet will be generated. I.e, t+k, where k is the time interval) P8 ?5 I# @# z) A. b ^( T# f
until the next packet
. K+ h. a# P" Q. ?- q1 z5 f arrives. $ @# U- v5 [! R1 E) K
4. Collect all required statistics. 9 U, n2 O" Z" ^! B: W9 t: y; C+ B
} ! U( u4 s2 g6 r0 c7 A
In your simulation, collect the (a) queue length over time, (b)
; {5 m1 u; |; W) ~: R* @- Baverage queue length, (c) average
/ u1 d# ~9 W7 t7 w. ` end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
4 ~% Y! E9 V4 H5 veffect of the following
3 X$ @5 F, k' N# F6 H factors: (i) increasing source and receiver pairs, (ii) varying N
+ F( r+ ^& A2 \( P1 Cvalues, (iii) different packet loss
9 u3 d% T( L9 ], y0 a! _4 x reporting periods, (iv) loss calculation methods, (v) load p, (vi)5 P. o3 p9 ?$ j1 J! h: S
router’s transmission rate; # ]. ~ W: g. h |. x+ \6 k7 \
instead of one packet per‐tic, try k packets, and (vii) z
' d" y u) F7 L' @" S) Cnumber of new flows. J( v2 s8 N+ d$ L6 t
arriving at time t . : y; f: K3 y" b3 I4 W
6 v/ R) y0 Y* W4 S# }$ j
; T1 y7 D' l5 B4 L6 Y# L : Q0 h( k1 R, u2 Z. Y
Do with sources
7 J6 i' q- f! R7 d3 q. jusing a token/leaky bucket to control their transmission rate. $ I) ~# D) l- Q+ k' M* P$ C
Another difference is that each source has an application that
/ q# h2 p, ]! h% sgenerates bursty traffic, where ) k& [+ H0 t1 D% c( ~* U8 F) \
multiple packets arrive in consecutive time intervals.
. S$ \: i% T& y, W! d3 w0 x To generate bursty traffic, use the following method: 4 I; L# M, Y, L+ d- ?0 r5 x
! C6 \+ g9 ]; J8 I& f7 p
( }! u& m1 Z4 b- Y/ h0 w7 I
In the diagram above, an application generates a packet when it is in n2 ~3 i# T6 v' m7 W1 E2 C; n
the ON state. With . ?2 g/ M0 a* t8 |/ J
probability k, it will transition to the OFF state where it will remain idle. In1 k _2 a' M. o8 d1 J' o3 l
this state, it has
" Z7 ]6 v& ]# l U- d( s; C probability z of moving back to the ON state.
! R8 m: i/ Y4 G7 m5 } The pseudo‐code is as follows:
9 l4 |3 a1 a& L. ~' C 1. Start at a random state: ON/OFF. ( \8 Z" B" b. d: h6 K" D; @$ D
2. At every simulation tic, do - C3 c9 l3 g; h* F0 Q
a. Select a random number R in 0<= R <=1. 7 f$ r6 e+ Z& |- u/ m5 h" n
b. If in state=ON2 r7 N ~2 `) A. G9 P
AND R>=k, set state=OFF. : t* S4 A4 t$ x( e& E' C! X
c. If in state=OFF AND R>z, set state=ON.
% U9 Z$ D$ J' m' k3 M# H. j d. If state equals ON, generate a packet. + F# Q, P7 R9 b, E0 n# i- L5 K
Design an algorithm to control the token/leaky‐bucket rate of each
J$ V% W/ D* d/ |' Y% Y* y/ fsource (or all sources - Z% ]# _5 @4 q7 n/ n7 Q
simultaneously) such that congestion does not happen. Note, you must/ e' }7 U) K( Y& m7 Z
experiment with / z+ w8 o, k: a7 a9 }: u$ [3 ~( @/ E
different k
) }- M6 z3 p$ H$ B* sand z
# B4 k- L5 [8 _" w5 Dvalues and determine0 \/ b' ~" Y; F" ?& n7 u7 t
their impact on congestion.
7 r9 d& L/ b; b+ p! b4 Y6 u Reference ! L* S% W% _' s; D1 P, C
S. Floyd, M. Handley, J. Padhye,
y2 L' |5 A$ Q6 X: T! Gand J. Widmer (2000) Equation-based Congestion Control for Unicast
( A8 w* c. }& u# Y# @* i Applications, ACM SIGCOMM, May,
; u- i% R, x7 P ^8 D% i2000. ; r$ T& ~0 b0 q9 x. U5 a
8 v+ ]2 y7 f' o0 ]$ B6 H
4 Z/ ]3 {8 c# ^* n0 d$ {2 X
|