在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下
6 ~5 ^. Y% ^1 S* o4 j The risk of congestion collapse on the Internet is becoming a reality
! v: W% c. h" q2 Q/ R) q* Bgiven the increasing number
8 J3 u# q$ M+ u- t/ D: q: X of audio/video applications that use UDP as their main transport
( q# C" g* `, Q9 t) r* q) cprotocol. Unlike TCP, these 2 M% T' q' d# M9 U
traffic do not respond to congestion signal; i.e., a packet loss. As a2 A- i ^2 G. I: l+ n' I7 q) C
result, audio/video 4 d" J7 h7 Z# R: u- x4 M" W
applications may take an unfair share of the network bandwidth and- w! I+ S {" ]8 ]2 k/ l1 V
also cause persistent * p6 X/ w. r, J' X
congestion. To avoid congestion collapse, the IETF has proposed that
. R% k! ~" ^) H1 S! haudio/video applications X$ L$ c2 @' {9 j! ~4 o5 m6 b0 s
use equation based congestion control (see Lecture‐7 and the reference
: U! {2 Y1 ?: O% P+ `- wgiven on the next 2 j; b$ H+ G5 Y% h ^! z/ L/ l
page).
6 X2 G! v9 j% S7 J" o& H7 Z: C In this assignment, you will simulate n5 E4 H$ r( d; ?; ~# L: z5 R
sources that uses( U" B) H' P- e* X
equation based congestion control to # ~# [: w. j: K- H( z6 \6 K% I
set their transmission rate. From your simulation, you will determine% P. a/ u/ A/ E4 T/ U
whether equation based ! X2 b0 I& ?* l7 ^
congestion4 ]$ r( G& \6 v# d5 g
control is effective in reducing packet loss, and hence congestion.
: D4 H) X7 @' m; |. \
6 `4 l# o, r4 K2 r* \
The above network can then be simulated as follows: 4 g! a4 F9 y8 N: c) j Z
Initialization 0 |, ~7 {, M$ W, O5 Y+ O) V
Set the router’s queue size to N, meaning it can hold up to N packets. / }) O/ ~- A) @& ]
For each sender, set an initial transmission rate, and determine the/ ?7 @7 p+ f" Q8 F7 z5 t
time when the first packet is
7 T( [; h7 M' L& e( l1 a% X to be generated.
5 r" z( |6 V; A( c2 u! ? Body
7 \3 N$ d6 R ^ FOR t=1 to SIM_TIME DO
V9 u2 O3 k; s9 C1 v2 P {
2 Y4 U2 H8 y0 N% C; e2 t 1. IF the router’s queue is not empty then dequeue a packet, and
. Y, w ?* r/ n5 Qenqueue that packet in , W5 e1 m2 O. X* H
the corresponding receiver’s queue. $ `8 H2 V4 y1 T3 r( I% e
2. IF a sender has a packet to send THEN
- C+ J! T( d/ P; t( m: q8 t ‐ Check if the router’s queue is full. If not, enqueue the sender’s
9 w' c: ^4 E( j. dpacket. Otherwise,
# N# t7 J. B1 {2 a9 V. d3 { discard the packet. 8 h6 f' |3 j( X- g# m5 g
3. Determine whether any packet loss rate messages are generated by
; d" Z" @& A7 wreceivers. If yes,
7 V; \4 P+ `1 p5 P" I- @1 d) y then re‐compute the sender’s transmission rate. Determine the new time8 a4 |, n2 R; d
when the 0 @0 f# A/ [- _: {
next packet will be generated. I.e, t+k, where k is the time interval
$ ^+ `7 W% P( C0 ~) b4 muntil the next packet s6 L5 E, }" Z0 n7 f; K! Y
arrives. 7 |% q: Z7 t9 l5 ?: x" U2 y
4. Collect all required statistics.
5 O, e$ S& L0 }; M) n" t- x6 O } 4 r n; V3 ?" L& u9 X4 j& i V
In your simulation, collect the (a) queue length over time, (b)2 y% o6 `4 H! F( Z5 U
average queue length, (c) average
' b$ F, ]: f# z* n- r$ T end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the6 N" X( P: X' S! g, v2 w' F: O
effect of the following 1 |5 a' f* }$ k$ }+ s2 C J2 I: `
factors: (i) increasing source and receiver pairs, (ii) varying N- @4 O8 F) p0 Q, q& v) M& a# _5 I
values, (iii) different packet loss 5 y; F! @; b3 `2 ^/ S& M
reporting periods, (iv) loss calculation methods, (v) load p, (vi)$ n1 M7 d1 X& t: Z+ s
router’s transmission rate; 7 k" m6 ^" x5 s) ?3 ]4 \8 _! s& N
instead of one packet per‐tic, try k packets, and (vii) z, z: J' {: Y G$ Y/ i1 q. ~$ K/ w
number of new flows
! O: m" R. S% Q: Darriving at time t . ! h( F# h% c+ l) k# o% H
! y) B Q, b" ^0 U
1 V$ V+ |/ J" o3 }9 `
* R) L8 m) E, c. P; {8 I9 X; [ Do with sources
2 d) S' K$ q6 B: r6 i) \; E4 v5 Busing a token/leaky bucket to control their transmission rate. 2 _+ F1 G! e5 h2 P+ j' M' U
Another difference is that each source has an application that( f; V6 j; V* q: P
generates bursty traffic, where
% v& B) C- \$ }" P& u2 y multiple packets arrive in consecutive time intervals. / d$ r: ]( y+ [! P
To generate bursty traffic, use the following method:
2 x- h& w- g+ q- T! M, B% K 0 ?6 t: ~" E% Q# w- A
G/ g9 V2 T/ m
In the diagram above, an application generates a packet when it is in
; c3 S4 i" \" Ythe ON state. With
. j9 k5 Z" N" V+ x' A probability k, it will transition to the OFF state where it will remain idle. In
% u+ S+ z: T- E& y- z- Mthis state, it has & x& T8 g1 c( t. D
probability z of moving back to the ON state. % Q1 j& V f) G( Q6 n. Y
The pseudo‐code is as follows: 4 [! h1 ?; M8 n4 T
1. Start at a random state: ON/OFF.
3 m. g- u1 F% N+ r& s 2. At every simulation tic, do 1 E: C- u9 s7 g
a. Select a random number R in 0<= R <=1. . r! V6 i( n! @. }: N# b
b. If in state=ON
! |3 u$ L; I) ?/ }AND R>=k, set state=OFF.
6 f+ A" Y5 `+ d/ J5 e* D c. If in state=OFF AND R>z, set state=ON.
$ m5 L1 H( j9 T% D d. If state equals ON, generate a packet. ' X. O; N) R3 c- S1 `
Design an algorithm to control the token/leaky‐bucket rate of each
5 l; ~$ g9 r8 [; |5 osource (or all sources
. l# _2 }3 |' F5 S: o S' T: Y& s9 w simultaneously) such that congestion does not happen. Note, you must( O0 `) R4 Z% H: F6 A) m. i
experiment with
) z" `, E6 D$ J: c different k: Y& d7 D3 I/ a- ^& V+ @9 J
and z& C \+ v6 N6 m( X5 m4 B3 g
values and determine6 G6 T, [2 ?3 R8 L3 X4 F
their impact on congestion. ! j9 Q2 z1 n- s% U b$ Q T" d
Reference
- @7 y2 a# u+ M4 n3 N S. Floyd, M. Handley, J. Padhye,
+ I" C5 N' ^ S3 ?/ rand J. Widmer (2000) Equation-based Congestion Control for Unicast
- X$ B5 o- q/ I* F5 B: Z Applications, ACM SIGCOMM, May,
( Y1 p* j6 {$ o8 r* e H2000. ) q N# P0 \4 L9 ]! S1 @7 t% w
- p+ j) f% h. j/ [, z3 t: o
' L$ u6 ^% _( }2 ]5 N
|