在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下
- y- ~& l4 d- j+ V The risk of congestion collapse on the Internet is becoming a reality
2 b, z0 [ |1 [" Vgiven the increasing number
. M' Q+ w5 S# X of audio/video applications that use UDP as their main transport
" ?& N8 z, u1 ]' zprotocol. Unlike TCP, these
9 K2 h# K2 p2 w( y traffic do not respond to congestion signal; i.e., a packet loss. As a
$ g# n6 M9 r. b3 V# qresult, audio/video 7 G& b& T: x9 M' I, U
applications may take an unfair share of the network bandwidth and" l$ R! j1 f2 p2 i
also cause persistent
0 g# t; ^7 \% I U; e; D3 L congestion. To avoid congestion collapse, the IETF has proposed that
$ F4 ]4 O/ B0 @" ]audio/video applications F% h0 J7 g/ D) ^
use equation based congestion control (see Lecture‐7 and the reference8 P. K, a" Q* y! w) x" i8 |# p
given on the next & m3 f4 I+ V* B/ F
page). 2 h9 v; N& V0 t/ L
In this assignment, you will simulate n
% i* x! y6 \/ v. Xsources that uses, ?- l/ v L" N7 x
equation based congestion control to
7 X! o; ^" G0 S- [/ L set their transmission rate. From your simulation, you will determine
! ~7 U) @# O9 y% @* x# Kwhether equation based
% H+ t+ S( p0 u" d congestion
6 T6 U# P# ?$ Y2 bcontrol is effective in reducing packet loss, and hence congestion.
( ~5 o8 S. z5 v$ G4 s z, l) L
. Z: b. @; V( ^( j5 M
The above network can then be simulated as follows:
) s" G/ l- P5 a1 `1 S$ }+ K Initialization 7 i0 U: a) g! O. z9 G+ X9 z
Set the router’s queue size to N, meaning it can hold up to N packets. / [4 |' f. ? x' d/ `) f% I6 r4 `& b
For each sender, set an initial transmission rate, and determine the* R0 d% K& S0 M% q
time when the first packet is ) q* C+ t6 f" u; l/ [
to be generated.
: `( `. Y1 U4 o: U Body
+ d7 S' b. e: W+ p+ M FOR t=1 to SIM_TIME DO , c( X4 C( ]! l' w0 E% t# s1 p+ }( R
{ : d. S" G! u8 J( s! i) Z0 L
1. IF the router’s queue is not empty then dequeue a packet, and) ?$ S& R8 O U
enqueue that packet in
& F" M; J4 Y1 B1 a% F the corresponding receiver’s queue.
6 y T& @% |) @: {% S* K% t( L 2. IF a sender has a packet to send THEN 1 T: L( o2 c7 s, T: M% i7 x2 _
‐ Check if the router’s queue is full. If not, enqueue the sender’s o! s3 J5 W8 Y: m6 L Q
packet. Otherwise, , m% V, j( q) u2 W. ~2 `% b" ^ E- w
discard the packet. " N, `$ U' S' m! R0 m" N* r
3. Determine whether any packet loss rate messages are generated by& ?5 @( }' i0 R, W; N
receivers. If yes, ) z: ]3 X& Q/ o. G) c, g
then re‐compute the sender’s transmission rate. Determine the new time
4 I; F% {! U& L, m4 iwhen the
9 z; k% i( i3 ]5 N1 G9 {. { next packet will be generated. I.e, t+k, where k is the time interval& H/ |7 k# h* L4 T
until the next packet + ]2 n0 n7 E6 E0 x+ Z3 F; b
arrives. ) z3 g, j6 H7 V/ I* `+ p
4. Collect all required statistics.
6 L: o. j1 I6 u' C* [; E. ~# s }
( E$ U3 ^$ l8 D$ p! x$ E In your simulation, collect the (a) queue length over time, (b); w+ {# d |! R0 m' I+ v
average queue length, (c) average
0 L3 \9 a' V) \ end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the% X8 B( v6 F( _3 a
effect of the following
& Y, o2 {, p$ ] factors: (i) increasing source and receiver pairs, (ii) varying N
8 @8 u6 B' j2 kvalues, (iii) different packet loss
3 N" `7 h* j( O4 C7 s4 Y+ u7 B reporting periods, (iv) loss calculation methods, (v) load p, (vi)0 [2 j' c4 N2 d
router’s transmission rate; # k. K1 p9 K& n: k
instead of one packet per‐tic, try k packets, and (vii) z
3 M, P) A4 R' ^' ^( n* B0 P. onumber of new flows
5 S! W9 ]8 W1 L, l: L) Garriving at time t .
8 B. W/ Z; b+ H% v8 R* q" y9 D& `
4 a3 d/ l! r7 b 5 v7 C# o- U+ D4 h4 |
: a- m$ H% o! J
Do with sources) I. [+ N4 ~5 @. ^4 K& l4 h9 U2 m! q
using a token/leaky bucket to control their transmission rate. % Z# K J. G( Z& @. Q& A# b
Another difference is that each source has an application that) N$ ~& X4 _) ], J/ \
generates bursty traffic, where ) f! D7 h' f( S* V/ M8 W5 c
multiple packets arrive in consecutive time intervals.
! k+ P6 g$ c' \1 |. m/ o3 e To generate bursty traffic, use the following method:
3 V8 g/ g2 c# }/ f% m' G9 ~ . m2 y4 [8 G n5 h
; F; G3 {( Q0 s, V$ e
In the diagram above, an application generates a packet when it is in
+ u- ]. s2 A/ P6 i9 Ythe ON state. With , r% b6 T' A* x8 o: J* J5 T
probability k, it will transition to the OFF state where it will remain idle. In6 }. ~$ e+ N) E8 Q- V; l
this state, it has + \2 F' i# w7 Y1 e0 V6 y% ~
probability z of moving back to the ON state.
2 k" B& S- H+ z The pseudo‐code is as follows:
1 S7 r2 ]9 w" H: N6 Z1 i) w 1. Start at a random state: ON/OFF. 6 {' l8 _% C% Y* x/ d. ?$ h' K3 n. f
2. At every simulation tic, do
$ U y9 A2 q& V" v: a a. Select a random number R in 0<= R <=1. ( V) j+ `! z& c+ e% G
b. If in state=ON2 k4 S6 N$ j1 e3 S$ Q+ \* p- M% H
AND R>=k, set state=OFF.
& U% I2 }. D( e5 r6 K c. If in state=OFF AND R>z, set state=ON.
" \, }* @/ B$ }- H d. If state equals ON, generate a packet.
: }0 ^1 ^2 g7 D Design an algorithm to control the token/leaky‐bucket rate of each/ _% L# t h2 f! i! d7 l
source (or all sources 0 `- ^9 y9 _) W
simultaneously) such that congestion does not happen. Note, you must7 b. j4 y1 b7 D) j: s
experiment with
' X4 B6 G# D- K5 {# f2 Q j0 Q" z- i different k2 R8 r: S9 A& k, d3 }7 C
and z
" F7 Z9 n% Q& w _9 G2 E6 }8 v* Qvalues and determine
[) d& @) U, T& V+ i Htheir impact on congestion.
8 z' E4 B9 d3 M Reference
# T; o7 a$ }- k/ r& `4 {9 C& h2 r S. Floyd, M. Handley, J. Padhye,
& w" Y( M: a* _) R) `# g/ n Sand J. Widmer (2000) Equation-based Congestion Control for Unicast 0 O$ k Y' ?, O5 H9 w" B! ?1 M) |7 k9 ]
Applications, ACM SIGCOMM, May,
/ z/ X$ N5 U8 n9 R' @$ C2 a6 _5 x2000. 0 X1 A- s- v! _! k% r! C
" x. \# w+ V0 o ) c0 K' _! f I; W+ @& S
|