在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 6 C! d: J& ~7 ~* ] S
The risk of congestion collapse on the Internet is becoming a reality% d. r2 O# ?; P; @) W7 d* u9 j
given the increasing number
! q" o5 ?7 s' u1 X of audio/video applications that use UDP as their main transport2 C& n6 O' G$ ^2 z# q; D2 i7 B
protocol. Unlike TCP, these
! X1 X2 E& j1 r' q traffic do not respond to congestion signal; i.e., a packet loss. As a
! d# a, F' G9 H, S( k9 R+ Yresult, audio/video
4 L' p' Q) d# s. K5 I- c applications may take an unfair share of the network bandwidth and4 |- x9 w0 Z% q# q
also cause persistent ; P8 t; ^. r# H1 K* |
congestion. To avoid congestion collapse, the IETF has proposed that
# @4 D/ [! f& A2 ?$ [1 |- Oaudio/video applications ( h1 Q3 ^4 r$ }* q
use equation based congestion control (see Lecture‐7 and the reference4 I' U8 f! I" d- x! Q7 N
given on the next 1 I& B' R4 z+ z) n5 B+ X# U
page). 5 h& d# [7 K3 p) ]
In this assignment, you will simulate n
# |+ Z- z! V! hsources that uses
: C) x9 X6 P5 R' {1 E t9 gequation based congestion control to
+ U, ]8 h. d$ H$ S set their transmission rate. From your simulation, you will determine0 T7 q4 q! t3 |! C. d7 g
whether equation based
2 ^ i, w# ?* n+ s B9 Z congestion' y. E- {/ r, Z
control is effective in reducing packet loss, and hence congestion. * z1 R1 ~9 f4 U0 Q' ]# v% q! |
8 m3 H1 I! R, u4 r1 j The above network can then be simulated as follows:
" Q% W, U6 S* D# f Initialization
3 ~8 G$ n; u x. Y* z6 b5 v* u+ p Set the router’s queue size to N, meaning it can hold up to N packets. & U3 V0 v/ {- b# P7 I) w0 K) x
For each sender, set an initial transmission rate, and determine the
; W' F* y7 z( O1 H2 Etime when the first packet is 7 G* v* {9 H! f+ f
to be generated.
# ]# n% Z+ r& A8 X; K/ ` Body 2 h) p: s7 A/ `" S( v2 L% x
FOR t=1 to SIM_TIME DO : P( C& b2 C* D2 A7 }1 H! a
{
a2 U, Q9 C0 ]) K" _7 q6 ] 1. IF the router’s queue is not empty then dequeue a packet, and4 [+ t# }% j- [8 @; [8 P
enqueue that packet in
T) s6 `! w4 J1 x8 P the corresponding receiver’s queue. 2 ]7 d; P. s, r; X' v
2. IF a sender has a packet to send THEN
* y2 z/ j8 d% J! c5 H! r$ f- z ‐ Check if the router’s queue is full. If not, enqueue the sender’s$ G5 E* u; A- V. @0 @! U& M
packet. Otherwise,
! u# a w/ O8 ?9 U* m7 D, r discard the packet. ! c E5 Z# Z6 Y5 v( |
3. Determine whether any packet loss rate messages are generated by
+ T6 P% U- ^3 c% u+ P$ Y! Greceivers. If yes, 7 ?- j' g% ^% {/ H. x: F, \/ R- {+ u
then re‐compute the sender’s transmission rate. Determine the new time
& P# @- [# W! @, Y. d3 H' t- S4 Vwhen the
: H; A, J3 O# n$ m6 b" G next packet will be generated. I.e, t+k, where k is the time interval2 m' t' ?( c1 N, A0 i! \6 D& r
until the next packet
$ Y! e% U5 B! a D6 V arrives.
d3 p' D4 w: n3 P0 o1 Y 4. Collect all required statistics. 3 D2 I* S( q ~& Z
}
. z$ |) q! E( B0 ?" q6 [ In your simulation, collect the (a) queue length over time, (b) |1 ]9 { V; E& I4 D. _* ~
average queue length, (c) average
* x( P+ @: v# @$ y1 S end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
; y5 Q* q! ?% Weffect of the following 4 z& }: t$ i/ n5 Z [! H% `, g
factors: (i) increasing source and receiver pairs, (ii) varying N5 `; g# h; Z+ ^1 R5 r
values, (iii) different packet loss
8 }9 u3 \" K7 I+ E- E+ Q reporting periods, (iv) loss calculation methods, (v) load p, (vi)
3 L" R$ N( ^1 c4 }+ Krouter’s transmission rate;
" U: }7 S) h1 E! d instead of one packet per‐tic, try k packets, and (vii) z
( o+ Z) E) q) C$ f: O; `number of new flows
4 R5 G' z6 B) j' p) C% | G) Rarriving at time t . 8 L# p1 o7 v, ~" M& s
' } H( z- h0 _# F; U 8 D! J$ _6 T6 P$ e8 o. Z
3 X. J5 N& k3 k! f, y Do with sources" o1 |7 g5 M p; h) o
using a token/leaky bucket to control their transmission rate. 0 O8 H' i7 G! t" m
Another difference is that each source has an application that; r6 G. f) E3 Y- S
generates bursty traffic, where ) o A# a! Z9 C) N! e+ z6 n
multiple packets arrive in consecutive time intervals. 4 N% f. Q2 k& W C; K
To generate bursty traffic, use the following method: . w- [% T0 O6 D% S, z7 ?; @- |9 J9 [
. o* T- c- Y6 Y* h; A: W' w( l
4 W1 x/ @$ t# F3 k3 u' w In the diagram above, an application generates a packet when it is in) ]$ o, A% L, Y( W9 I; t* S8 P
the ON state. With & W9 [# W4 B0 j( x2 \4 L
probability k, it will transition to the OFF state where it will remain idle. In/ h1 Q$ l5 ~$ f1 l4 R2 m
this state, it has 9 e% ]/ a9 O7 U
probability z of moving back to the ON state.
$ {$ B/ {' i3 D3 P. k# `% S& Q+ b The pseudo‐code is as follows:
6 B! v/ C- b) o5 A$ U 1. Start at a random state: ON/OFF.
; f" h5 z/ O7 F y- o) V } 2. At every simulation tic, do & N, R9 k k9 a0 u7 X' c
a. Select a random number R in 0<= R <=1.
/ n+ C- b4 u& f3 p& y4 Z& ] b. If in state=ON
2 g: P9 R' `3 w9 cAND R>=k, set state=OFF. $ O2 H# Q. ~. k; t
c. If in state=OFF AND R>z, set state=ON.
: O/ [/ a( ~7 S d. If state equals ON, generate a packet. 9 K; U3 T: s3 y# R* ]
Design an algorithm to control the token/leaky‐bucket rate of each
- R3 @6 T+ B/ T8 I% e0 W6 qsource (or all sources
% _' i5 ?3 D! n9 D. X$ m simultaneously) such that congestion does not happen. Note, you must/ x4 m' q9 Y. L- K7 S- b7 J
experiment with
# b4 m7 h% B. u different k: F6 L+ _; _, a
and z& Q6 H' _; ?4 g$ J# G; A r# V8 H
values and determine+ N+ s8 |8 L% O4 Y
their impact on congestion. ' Q. \' W4 l9 T' [: @2 x
Reference ! n" ?% |& w3 m
S. Floyd, M. Handley, J. Padhye,$ A9 |! D/ B) M) l( n" F
and J. Widmer (2000) Equation-based Congestion Control for Unicast 3 g0 F1 A d# e5 i- f, m, x
Applications, ACM SIGCOMM, May,# W. H6 s, l% `* R6 B& r
2000. ; Z$ M+ B' ~% I; U" q
; N! U) y0 m+ e+ r
3 _, I1 v' |+ M7 R6 G- f
|