在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 : S1 _5 _& w" o; n& r& \
The risk of congestion collapse on the Internet is becoming a reality) E* q' P# M4 z# d+ Y
given the increasing number 2 V* d# ^2 l j8 W
of audio/video applications that use UDP as their main transport
) ~, N* h* g2 n* o$ kprotocol. Unlike TCP, these
L3 x$ W& c8 g3 k traffic do not respond to congestion signal; i.e., a packet loss. As a
# r3 f* e" e* K* L* P2 X J9 uresult, audio/video
- U8 `0 a: H9 f) {0 ~; d/ }* F( p applications may take an unfair share of the network bandwidth and
; X2 ~+ t& V/ T$ aalso cause persistent
) ^3 H" t4 m8 [ O7 g congestion. To avoid congestion collapse, the IETF has proposed that
' P7 s; m9 a" G; B+ Y' laudio/video applications ; M) f1 K2 N: s8 i9 k# w
use equation based congestion control (see Lecture‐7 and the reference- Z0 o; a$ P$ f; `; j6 e" ?
given on the next
* D8 ~7 z" }0 i9 r page).
( v: W8 V! s* J In this assignment, you will simulate n: C9 h2 p$ q6 y6 P% w
sources that uses
7 c, ^) i$ q* Tequation based congestion control to
! Y! B+ v$ A* T& H set their transmission rate. From your simulation, you will determine' @7 b9 [, o/ U D
whether equation based
: i% J! Z3 N- |% R4 W congestion
3 P- Y; f4 W6 p) Q$ Z0 J2 @control is effective in reducing packet loss, and hence congestion.
* Y" A8 ~' f7 F9 p/ Z, C; m$ B( ]
9 Y+ a( i+ Y& m0 l& \! z
The above network can then be simulated as follows: 5 C5 E7 a$ b7 D( P' i6 Z
Initialization
& l' j4 ~2 y7 b% v Set the router’s queue size to N, meaning it can hold up to N packets.
6 \( ` `: S5 I- z2 } For each sender, set an initial transmission rate, and determine the" \7 l* a" T1 H1 P! L; j5 p( d$ u
time when the first packet is G V5 @/ J, d$ w0 }- o
to be generated. : W6 j' @' k/ I6 Q* y
Body & W; O3 L% S& x
FOR t=1 to SIM_TIME DO
+ j+ b# Z: e3 E* e9 c1 I0 Y { ' d9 `/ C5 J# \6 m
1. IF the router’s queue is not empty then dequeue a packet, and
' R9 C9 m; d6 z& n' xenqueue that packet in 5 r) ^7 e7 |+ \/ }7 t1 |- ]9 @- T
the corresponding receiver’s queue.
0 c! _4 A8 D4 a# X 2. IF a sender has a packet to send THEN ' b& V/ B4 l4 i! |- u5 Z) \
‐ Check if the router’s queue is full. If not, enqueue the sender’s
7 ^$ i" e& V4 a$ O8 _# M, t/ c% m, Rpacket. Otherwise,
9 e2 r. r4 }& Q: n- }" N discard the packet. 4 D) M; J6 u$ V" w& @( d3 h
3. Determine whether any packet loss rate messages are generated by
% `& H. D, I' r+ O1 f# k6 \receivers. If yes, + @5 h& T* F- ~) C! a5 Y
then re‐compute the sender’s transmission rate. Determine the new time' K+ {7 v5 b4 k! [0 M
when the . [0 X# O6 G' ^7 C. j. ^8 y
next packet will be generated. I.e, t+k, where k is the time interval
. |) E5 z& Z* K% Vuntil the next packet ! S6 n' R5 j, G4 g& C
arrives.
" Q: f4 J3 d( I# h0 R6 I 4. Collect all required statistics. - e3 F) ~! p% K2 `8 U3 `
}
- a% z) K9 b8 Q1 x( P+ h. ~5 \ In your simulation, collect the (a) queue length over time, (b)- h. R# F' U0 W4 k
average queue length, (c) average
' q: F9 O+ ~3 \. o! Z/ @' C end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the+ q$ z# b9 a; A
effect of the following 8 P( y' r- W+ l
factors: (i) increasing source and receiver pairs, (ii) varying N
; [5 {, u: s) [" o! w6 V* Mvalues, (iii) different packet loss
$ K( X ?9 S& s, _& O1 o& A; K0 i reporting periods, (iv) loss calculation methods, (v) load p, (vi)
& i9 k3 ^; V3 G" U- ^1 |9 Yrouter’s transmission rate;
% W2 Q0 p6 w6 F$ R" {6 w instead of one packet per‐tic, try k packets, and (vii) z
( K4 w* e1 f, l/ gnumber of new flows" U: v2 Z$ `$ X, q
arriving at time t .
S8 V: V, P9 z& Q2 C
2 [7 u9 Y9 {6 |+ q; c
- o; Z' h' p4 W0 g# _' j( X
8 l7 I- D0 Y2 i2 C Do with sources
4 h2 p/ a; [# h" Y' g$ Ausing a token/leaky bucket to control their transmission rate.
q/ o( r% M! Y- X$ c Q Another difference is that each source has an application that! U% u/ A4 V/ Y0 B/ f
generates bursty traffic, where 2 P s5 @/ v* J7 P0 z! X
multiple packets arrive in consecutive time intervals. : L3 Q/ c5 Q+ d" o# D
To generate bursty traffic, use the following method: & n' c8 G6 g# S, e. G
' p6 |; m0 A( ? 4 Y l% f3 Y1 V& X
In the diagram above, an application generates a packet when it is in3 @% I7 o2 v/ f) X; ?$ }
the ON state. With
3 M. q9 ^! ~( G$ @/ a& }4 G probability k, it will transition to the OFF state where it will remain idle. In7 G* R$ n9 r' b" Q
this state, it has ( \9 n$ X3 g0 `, C) y
probability z of moving back to the ON state. 8 x- Z6 g& g, Q; V7 ~2 |
The pseudo‐code is as follows: 4 r3 E2 X) I) R! k* X6 z/ D7 v
1. Start at a random state: ON/OFF.
a7 N3 b6 R9 \9 w# N( F 2. At every simulation tic, do
' @- f8 ^& U* g/ f a. Select a random number R in 0<= R <=1.
+ [" o: ]* W/ B b. If in state=ON3 M" Y! W4 c) g; J9 m& a
AND R>=k, set state=OFF. , F1 m( {" ]' a& D
c. If in state=OFF AND R>z, set state=ON.
v/ F& w7 ?- S' z3 M7 } d. If state equals ON, generate a packet. ( s7 t2 Q% S, H& l$ I
Design an algorithm to control the token/leaky‐bucket rate of each4 P1 l" y! b) H2 i1 o8 J
source (or all sources
0 q L9 Z: U: n. e/ q simultaneously) such that congestion does not happen. Note, you must* d4 @% A* {/ f
experiment with : ]. m8 Y: R, y9 Z! u$ k' u
different k
$ W) Q# c" V+ n9 qand z
& J/ ?1 W. E0 H! g( }) u: jvalues and determine; A" Z5 o/ @0 u" O- n
their impact on congestion.
" O, m2 K& z5 v7 D Reference
5 j% }0 h7 w# Z' e; i4 N) W ` S. Floyd, M. Handley, J. Padhye,4 ^' i+ U( b& y) u' p+ m
and J. Widmer (2000) Equation-based Congestion Control for Unicast 0 m; {" W2 J# Y+ }
Applications, ACM SIGCOMM, May,& C* V" Z4 ]* b6 x& g8 w" C3 |3 Q: r
2000. / B/ d$ U( A( f5 ^& x
: T- ?3 R% Y1 u# f
, e* T4 G3 ]$ w2 {. L S
|