在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 ( `3 K! ?- ~5 ^! p1 Y/ D
The risk of congestion collapse on the Internet is becoming a reality4 s( L/ \- ?% }; ?( L# f
given the increasing number
^9 }, l7 ]) a; ], S! I6 F& p' W of audio/video applications that use UDP as their main transport* _, v. x2 e \7 s
protocol. Unlike TCP, these ( l' a# j( n4 t# H; a
traffic do not respond to congestion signal; i.e., a packet loss. As a
, A5 r/ b$ C+ C1 _! Z; T1 M3 dresult, audio/video
/ i( X, j7 Q, L+ F7 l applications may take an unfair share of the network bandwidth and
, Q1 u5 u- K* K' valso cause persistent
7 X- d. t" A" `; d: [ congestion. To avoid congestion collapse, the IETF has proposed that
( j# Z2 h5 c2 G7 ?audio/video applications 0 k. N$ Y5 Q* ~9 C9 k. }9 `
use equation based congestion control (see Lecture‐7 and the reference z; B6 R4 W6 F3 u) K3 q) j
given on the next
* g+ V! m8 c- S page). ! j9 k/ _; F. l7 X* h
In this assignment, you will simulate n
0 [ \2 G# a, p" n) q' s8 Ksources that uses0 ^1 n" u3 K% e7 K
equation based congestion control to - j' @1 @: z( s9 g
set their transmission rate. From your simulation, you will determine' S2 X% Q: E9 c
whether equation based $ m1 _ E4 O; C- z# W/ O; U# H+ |
congestion h. U, v$ G' H ^# [$ I
control is effective in reducing packet loss, and hence congestion.
$ T$ ~( s) g2 \3 i: j) N$ n
5 a' C/ g' x1 @8 ?+ n; M7 ^. l# V/ \ The above network can then be simulated as follows: 7 U2 m* u' i$ Z1 E5 i6 K
Initialization
9 y" _9 J/ S* | Set the router’s queue size to N, meaning it can hold up to N packets.
2 A6 i8 j d& u& V& Y3 L5 r For each sender, set an initial transmission rate, and determine the7 r3 R0 j5 ]# O5 l1 C; g) S. ` d5 [& F
time when the first packet is * D) ?5 m! K }6 Q& @9 U, U
to be generated. % W* y. _ P% K2 F2 g
Body
+ o0 U: Y' H5 u0 l' _; F FOR t=1 to SIM_TIME DO 9 E* J( S. n. v! z( P3 m
{
) a) }1 _! j4 R! C 1. IF the router’s queue is not empty then dequeue a packet, and, n3 { v. b3 J& I) X9 q
enqueue that packet in
& C/ x5 |3 u. v the corresponding receiver’s queue. + S N0 l/ z* H# R% a
2. IF a sender has a packet to send THEN
1 T. U: O x8 t ‐ Check if the router’s queue is full. If not, enqueue the sender’s$ Q$ R" O" F: j* E
packet. Otherwise, * ?$ U. X5 ?: V9 k* Y, Q
discard the packet. ! n [# U" \2 g8 `; x
3. Determine whether any packet loss rate messages are generated by: h: N0 v/ K, _5 [
receivers. If yes, 5 R% Y3 P+ o( w$ `" v6 r# r$ i' @
then re‐compute the sender’s transmission rate. Determine the new time/ k O Y4 E0 {7 G
when the
7 ]7 y0 e- y# e5 g" o next packet will be generated. I.e, t+k, where k is the time interval: n' I( D: v; ^( P$ m
until the next packet
8 ]& ?5 Z3 |8 M6 D: D, |4 u7 z arrives.
9 c' _3 g8 r$ e5 K' Z9 | 4. Collect all required statistics. 9 ^8 B' O: r* l( v
}
( O3 d6 I/ X! E; l0 E; R% o In your simulation, collect the (a) queue length over time, (b)) k( c1 }: ?) C) |$ o$ j& W/ F: A
average queue length, (c) average
, ~; g6 c: V5 Z! K end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the' i5 K; K2 O8 Y9 E
effect of the following . I, s" U0 Q, D2 a: t
factors: (i) increasing source and receiver pairs, (ii) varying N
$ ^4 j2 _1 V! y' ? ?values, (iii) different packet loss
# m; L4 e6 x. R reporting periods, (iv) loss calculation methods, (v) load p, (vi)" e( ~9 }8 Q+ O% a# K& }
router’s transmission rate;
- H. s3 M4 n& k9 X2 J+ @: H instead of one packet per‐tic, try k packets, and (vii) z
; u/ t4 h# P4 |2 _9 q, P# ^number of new flows
. i% e( m" m8 h0 E M/ X/ d w' @! Yarriving at time t .
7 V" ^: T7 U! ^ , s' J( [+ Y* g0 W& d: `% _6 `2 v
% K- |! o c1 ^8 p5 G6 ]& j1 y! s0 N+ e
V7 z& j, M& r2 N! i& a# V+ ]
Do with sources
- {% o/ e7 p9 {1 ^ C2 M' xusing a token/leaky bucket to control their transmission rate. * u" ~# N+ j. ~6 V1 o
Another difference is that each source has an application that4 @* n- m: Q; _: U# |5 G# @
generates bursty traffic, where
* f8 A; ^ z: J ]; F5 Q, } multiple packets arrive in consecutive time intervals.
) U: j0 s7 @) B( S4 m* Z+ ] To generate bursty traffic, use the following method:
P3 H- U7 V1 ^ 1 L8 p( X* M2 D! ]
% K4 Q% a6 i# O) L! u* z( L+ B0 r* f In the diagram above, an application generates a packet when it is in
8 u% v: t% V othe ON state. With
! U0 c* {) N3 I. v% j0 H probability k, it will transition to the OFF state where it will remain idle. In
( r' a: {+ E. Jthis state, it has % n' K0 S! v5 p3 A. Z
probability z of moving back to the ON state.
7 @4 E6 R+ I2 @ The pseudo‐code is as follows:
5 P+ t p1 F) A) P5 i 1. Start at a random state: ON/OFF. 7 F% Y3 o) |" H
2. At every simulation tic, do
% V* H, k( Y5 x a. Select a random number R in 0<= R <=1.
( l K5 m7 J9 x" Q! _$ w( d b. If in state=ON8 O W& ~8 x, O( e
AND R>=k, set state=OFF. / [0 O9 j' e( P$ w% J# P
c. If in state=OFF AND R>z, set state=ON. 7 z& F; }0 E3 g# F. q' ^
d. If state equals ON, generate a packet. 9 ` E' l+ v. D% y" p% T* d: I
Design an algorithm to control the token/leaky‐bucket rate of each
( @! u$ u4 X: ysource (or all sources
3 n$ L. P& l# m1 V* j0 j" B6 B. ~ simultaneously) such that congestion does not happen. Note, you must: ^6 q6 a6 e5 K1 Z
experiment with
" ^' _$ r( ?4 ]+ l. {# I' p different k
7 ]3 p V; n& t9 U' B& Y- G( Yand z2 g8 t \$ l x( ?. h
values and determine
) G) T3 S9 d+ C' n/ Gtheir impact on congestion. - \" J' @' u4 x) _- J5 G1 }
Reference 7 U2 A! X9 V6 m6 R5 O1 A
S. Floyd, M. Handley, J. Padhye,! x. u' ]8 r4 f- o/ l
and J. Widmer (2000) Equation-based Congestion Control for Unicast
- {% u4 q; ]* T* Z5 E2 w Applications, ACM SIGCOMM, May,& k- x6 m. C! k- z5 D9 V9 v
2000. 4 E, n( u' t! x: T4 _1 j
) U+ ?& M+ B; ~. Z( O7 s
3 w( {6 e3 ]4 o K
|