在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 9 R3 \" O8 q9 b f1 y1 j. s) I
The risk of congestion collapse on the Internet is becoming a reality
8 B2 E* m: U: n6 ]given the increasing number 4 ?4 l- U5 Y: l0 V2 _ s
of audio/video applications that use UDP as their main transport( s% F- b2 Q# s& @6 e+ |/ _
protocol. Unlike TCP, these ' b2 W1 P) O+ M. Y4 E
traffic do not respond to congestion signal; i.e., a packet loss. As a
. a7 W8 R' ~1 b @2 Xresult, audio/video
" j5 }8 s j& I" J0 X& Q applications may take an unfair share of the network bandwidth and
x) a% _7 `2 t* O: xalso cause persistent
3 Z7 A3 b+ f6 b; X M' x congestion. To avoid congestion collapse, the IETF has proposed that4 _6 j K, O, p3 Q- G% C' N3 p
audio/video applications , A7 Y! m0 s1 e5 n; U
use equation based congestion control (see Lecture‐7 and the reference
. I" o4 A9 h; i S! a8 z1 Vgiven on the next $ A; [- m/ @4 l: \
page).
5 r. p, H8 B! ?" |# R6 E0 K" K In this assignment, you will simulate n
* z5 u$ G0 z% C- {sources that uses: d6 y! A. ?$ Z
equation based congestion control to 3 C0 \+ L3 d8 |" v! z
set their transmission rate. From your simulation, you will determine. f7 e8 S+ \! }4 a7 J
whether equation based . d/ G, Q! f+ R& E8 n4 K
congestion$ B+ n. X1 V# V# \- ?
control is effective in reducing packet loss, and hence congestion. ' A9 |* l4 X; s7 V2 u
9 R+ m' F1 W+ c* D. S
The above network can then be simulated as follows:
, O. l+ K% F. p) P6 { Initialization
0 m) T* {$ c: u" H' Q( a Set the router’s queue size to N, meaning it can hold up to N packets. # o" ^3 u) h) [: I; H
For each sender, set an initial transmission rate, and determine the
3 f; {7 B# Q3 C2 @' |8 Ttime when the first packet is
& l. b s) C! s& P) e to be generated.
( d5 y5 E& K+ y Body
# A" A4 U- @. u Q/ `) C2 n2 ] FOR t=1 to SIM_TIME DO . b8 y: e* s3 d8 B6 u; W
{
* @* m# Q8 a# F8 f* k9 Y/ E* v 1. IF the router’s queue is not empty then dequeue a packet, and
! z0 k6 {; b8 a" O- h* O! q8 tenqueue that packet in R! r% P1 [! z" H# q# k, L
the corresponding receiver’s queue. 4 z$ h9 |9 V- ?" n* X: D
2. IF a sender has a packet to send THEN
2 [/ t- M' @: I: s4 _; c9 \ ‐ Check if the router’s queue is full. If not, enqueue the sender’s
- Z% B( a: y3 q" H0 Y, @& qpacket. Otherwise,
" G* \8 A8 h T9 m8 _) A discard the packet. * A# k2 A2 N, p& M3 C& V) Y
3. Determine whether any packet loss rate messages are generated by
; ~$ I+ F6 D0 x7 `4 Lreceivers. If yes, * M9 W: R" R2 h0 h' n
then re‐compute the sender’s transmission rate. Determine the new time
# @& b7 S8 p/ z8 j: iwhen the
1 Q3 K3 N# a, `6 W# ~( C next packet will be generated. I.e, t+k, where k is the time interval
- e. C, S; k funtil the next packet
& t$ J; J i+ _5 C& G- D' _6 ^ arrives. 3 v- ?: D: Q8 g1 k% W$ q5 V' G
4. Collect all required statistics. $ K o6 T- q5 H' D
}
( Z, X/ a* A1 I% m6 B In your simulation, collect the (a) queue length over time, (b)
: s2 r( O& L* P0 faverage queue length, (c) average
, S' x- T$ D. G b( j5 T8 c/ v4 x, N end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the4 \; q. u7 k- t: o* E" r
effect of the following 8 Q) ?. p- V3 v0 B9 T0 x2 W1 m: T
factors: (i) increasing source and receiver pairs, (ii) varying N3 m6 K E R& D6 y2 [5 a- g0 s
values, (iii) different packet loss
5 |7 J* y* \' m reporting periods, (iv) loss calculation methods, (v) load p, (vi)
6 M0 m; \) L+ G) H1 z `router’s transmission rate; * y: B5 b. M; @9 N
instead of one packet per‐tic, try k packets, and (vii) z l) O* w: H6 W
number of new flows- @# K. f$ V7 o' s+ }" b# i
arriving at time t . * y5 Z+ }$ V- O S1 {
9 A$ J" ^, u0 D( |% e
0 N# E4 i* E# e$ g6 @3 ?+ t6 _
4 f: d$ K l, S9 \ Do with sources
& |6 [1 B8 `& M4 C9 w/ m; Y3 L Zusing a token/leaky bucket to control their transmission rate.
$ U7 ?, x8 ]5 r/ `" V: y1 j Another difference is that each source has an application that
& E. G) W/ b4 w- G( ^8 jgenerates bursty traffic, where
2 ]4 d$ u# o' \+ s9 X multiple packets arrive in consecutive time intervals. ( r2 `/ y- V" f0 Y& S, r' K
To generate bursty traffic, use the following method: 5 O* L& x3 o5 H1 |7 N
* B$ \, N8 b! M' y$ M5 G% W& ]
$ s6 ^% j9 F) y$ }* T/ l) |. G1 @+ u
In the diagram above, an application generates a packet when it is in
' o" c* R: a# }) B0 ]: A0 @( `the ON state. With
. F0 P: C8 O4 s" t. _; `. @* W, e2 N probability k, it will transition to the OFF state where it will remain idle. In$ I1 _5 r- p {$ ~1 n t
this state, it has
2 w% x0 |' O! z7 ] probability z of moving back to the ON state.
: o7 J- Q9 a8 N# ~/ A# I) b The pseudo‐code is as follows: # r x( c; }$ M' E$ r4 Y
1. Start at a random state: ON/OFF. ; `) l! q2 F0 |5 B3 s/ {
2. At every simulation tic, do , E: j4 |, X6 w) J( q/ e
a. Select a random number R in 0<= R <=1.
3 T3 t1 N. r! Z7 c b. If in state=ON0 s; v1 ]) \* U% S3 r0 B
AND R>=k, set state=OFF.
5 D$ a# L" U+ d, O+ j! ? c. If in state=OFF AND R>z, set state=ON. ' ?- F6 m+ Y0 Y0 x8 D" ^/ r
d. If state equals ON, generate a packet.
l4 g7 Q' S# i5 e- n Design an algorithm to control the token/leaky‐bucket rate of each
+ B' X% }) T* z7 v9 d- F& Wsource (or all sources ; R) J/ c4 q. F' K; r$ R
simultaneously) such that congestion does not happen. Note, you must
, k7 a# }0 \& k% Gexperiment with 1 k# h5 a/ R) G
different k4 }) h# R- H( o9 F
and z
3 C# Y: E, E* R* u* |values and determine$ y5 r& x( |7 f; w4 S. ?# K
their impact on congestion. ' E7 O+ ~7 {+ y' ?9 j
Reference
`/ }5 }2 u4 A+ R& O S. Floyd, M. Handley, J. Padhye,1 K! @. u, T% d
and J. Widmer (2000) Equation-based Congestion Control for Unicast ( \, o9 |. U- a. S1 T) H
Applications, ACM SIGCOMM, May,
N0 P1 v0 b. Y; `5 T! q1 ]2000. - g r) [+ b) ?) r
5 r8 n1 _$ W9 R4 a/ |
+ Q- E p) Y T4 b" T3 x
|