在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 8 P, m" @ V, Z h" A: A
The risk of congestion collapse on the Internet is becoming a reality
; a- e3 r; t, d2 M; E7 Hgiven the increasing number
+ A w0 v/ Q- w; [$ e) { of audio/video applications that use UDP as their main transport
3 B% P- o3 s2 Q* C( }protocol. Unlike TCP, these 3 a2 ?3 h) }, o2 z
traffic do not respond to congestion signal; i.e., a packet loss. As a
2 _; L, W0 D% Q$ C" @9 g. w/ P' W) ~' oresult, audio/video
( H7 l% J0 A4 X+ w: I applications may take an unfair share of the network bandwidth and
- b& u1 U& z, d$ f salso cause persistent - }5 ~( Z" J& a' X2 z8 Z2 q
congestion. To avoid congestion collapse, the IETF has proposed that
# n o, X( o- j, V5 p7 v" H# r% |audio/video applications
8 Q+ f& z6 O4 d j use equation based congestion control (see Lecture‐7 and the reference
% y% d6 m# b2 z6 U7 p) ]9 |given on the next $ M, z; W, ?7 \6 ^! d0 y. f# U
page).
- H8 V) ~! w$ m) T1 N8 | In this assignment, you will simulate n
* U8 S6 y' n% T. v6 r3 S# tsources that uses. c+ x. Z6 r; i, L
equation based congestion control to ' b" M, S/ U+ O* @. q4 @) I
set their transmission rate. From your simulation, you will determine
% S" u0 u! @7 |) `6 V( x+ lwhether equation based . V2 q8 r+ B) s; t
congestion
- S* V6 _7 f/ k( ?, Pcontrol is effective in reducing packet loss, and hence congestion. ) h8 J6 v* Y: [4 N
% [6 n" W; l4 v7 v( U The above network can then be simulated as follows:
! n0 k9 S x& E- V; ~. @; [ Initialization
# l0 m f3 c' N5 a; K Set the router’s queue size to N, meaning it can hold up to N packets. ; \, n, A3 \ `# m P4 Y
For each sender, set an initial transmission rate, and determine the
& U# W% D! |0 x+ p) |time when the first packet is u- u8 z7 F( b* _, ~+ l
to be generated.
# v& G$ f* N: J) x* V3 \ Body ' m) o' g& C8 L/ Q" `
FOR t=1 to SIM_TIME DO * R9 r# M) P0 J
{
! M- E2 L9 D A2 n; d 1. IF the router’s queue is not empty then dequeue a packet, and% l5 Z, O' y% ?8 a! M6 k( Z
enqueue that packet in 2 J$ @; g* M# A$ Z
the corresponding receiver’s queue. $ ~. D1 N; r) D
2. IF a sender has a packet to send THEN : F. K& z- o. v, A* s% ^" ~& t) ^
‐ Check if the router’s queue is full. If not, enqueue the sender’s
0 V7 R( [6 b/ r: Bpacket. Otherwise, 4 Y4 |& _: y# V9 t. G; e9 C: H
discard the packet. : O4 s( R2 R: G ]5 z( d8 U
3. Determine whether any packet loss rate messages are generated by
: d. F. }1 T+ p; m; P: U2 Rreceivers. If yes,
- L& P1 R& S. O, f) { then re‐compute the sender’s transmission rate. Determine the new time7 T# h+ O, \0 d2 Q6 Z2 T
when the
y# b4 g# E" M" @3 k$ x next packet will be generated. I.e, t+k, where k is the time interval
' [0 W# g3 L/ I, J6 [% E; funtil the next packet . Y x$ m( J8 b
arrives. " e/ o, l' k8 Z, {! ]; c. ?
4. Collect all required statistics. * j5 k+ V4 r$ J( T$ B l" @( c
} / _( z X) d5 X/ [+ [9 i, H
In your simulation, collect the (a) queue length over time, (b)
|6 y" v$ s4 _average queue length, (c) average
2 i: o# G) G' M8 |" l end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the4 r# X( B3 U- ^: C' m: A
effect of the following + d5 d) U/ h. b6 @# N
factors: (i) increasing source and receiver pairs, (ii) varying N, L( N) C, j3 r
values, (iii) different packet loss * {; t3 _* p& g" {
reporting periods, (iv) loss calculation methods, (v) load p, (vi)3 e b/ n% d% E6 `7 } M5 F) \" w8 d, G% f
router’s transmission rate; 3 o5 I; C5 a, ?5 y9 Z+ X
instead of one packet per‐tic, try k packets, and (vii) z- m5 X1 F+ X% g0 d% C. B) H
number of new flows
5 B: P. C" ]% w! [* ]arriving at time t .
F% Z, B2 _9 U- z* v
8 p5 I! R _1 Q
2 ]4 ^- J/ B8 p/ Z, C7 p 6 i3 Z: c C M6 A' t9 o \' i' R
Do with sources N8 k& g9 h6 o% Z
using a token/leaky bucket to control their transmission rate.
# r) ?; i( X! c! p8 C Another difference is that each source has an application that
2 C* v, }2 e1 Q& \8 F# xgenerates bursty traffic, where
r0 W; a/ O5 r8 p# ~ multiple packets arrive in consecutive time intervals. - p% ` ~; e6 x- D* ^
To generate bursty traffic, use the following method:
, a! k- K7 j) W; S/ T 5 M+ i/ o+ A) {3 v1 \% Y$ `
e0 n! ?& X) Q$ I* S, o( W
In the diagram above, an application generates a packet when it is in
4 F- N7 Z8 p6 y, ]1 y* B4 ]. mthe ON state. With 2 w" g4 u- o; _6 B
probability k, it will transition to the OFF state where it will remain idle. In
; O& ?2 U9 d( i t6 W! ythis state, it has 8 a" [( @0 S* w% Z( {7 s5 J
probability z of moving back to the ON state. s! [/ c' R, k, V, T0 d$ q
The pseudo‐code is as follows: + N" ?6 |/ g9 G3 |6 m6 s
1. Start at a random state: ON/OFF.
1 C0 m2 Y4 f% B, n; {/ Z f) }/ b 2. At every simulation tic, do , ]" o8 M0 }1 W q; [4 z
a. Select a random number R in 0<= R <=1.
% y) E5 P' n; h0 d4 ^( a. V b. If in state=ON4 _/ F3 A. R$ }% G! v( I3 x( M
AND R>=k, set state=OFF. ! W5 p0 q$ t4 ^" S4 f, {/ L6 S- B
c. If in state=OFF AND R>z, set state=ON. ) L0 x6 q: E1 s% e" R
d. If state equals ON, generate a packet.
; T. E9 Q0 ~, H* V4 i Design an algorithm to control the token/leaky‐bucket rate of each
' T' M5 [. N, q v& s/ k# \source (or all sources
" o2 u. {2 G+ ? R' s simultaneously) such that congestion does not happen. Note, you must6 e2 H# s Q2 \
experiment with
" |1 `" D ]8 d% W, ] different k8 P' D5 n4 H( \ o
and z4 X( q3 \9 b( ~; s
values and determine/ ` P9 P/ _4 V4 _9 `/ w
their impact on congestion. ! @& H/ M# k$ C; p
Reference ; j7 X0 C, ?, {
S. Floyd, M. Handley, J. Padhye,: o! v* j* {% x/ a; ]
and J. Widmer (2000) Equation-based Congestion Control for Unicast 8 Y6 }& H. L4 k1 D* I5 b
Applications, ACM SIGCOMM, May,
. F1 q% A5 e4 E/ H, S/ d8 j2000. / A N( u8 {9 y4 j( @# I& k
* u6 }, V9 e- |! w' E2 H9 ?/ o$ f
M; C6 Y8 y C5 s) }9 K; C
|