在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下
; j8 `3 f. G5 k: z1 S The risk of congestion collapse on the Internet is becoming a reality( ?# H2 N$ h! ^) f& U3 R% d; }
given the increasing number
8 x- Y% u. U! a) R8 P* c of audio/video applications that use UDP as their main transport+ z- T' s0 E+ i+ J
protocol. Unlike TCP, these $ z3 e1 M3 V* h/ i" f; ]4 m
traffic do not respond to congestion signal; i.e., a packet loss. As a
& T, C4 ]; b, C$ xresult, audio/video
' O- u7 K# T8 q+ w; a! k* g applications may take an unfair share of the network bandwidth and7 G' R. [1 P) a1 H( l* V
also cause persistent 0 U# U' x/ D9 o, Z! i7 A
congestion. To avoid congestion collapse, the IETF has proposed that
+ B9 r) H2 o3 V# Z+ K4 daudio/video applications
1 S9 R+ G/ Z# u8 H5 _" g use equation based congestion control (see Lecture‐7 and the reference1 o0 P# z6 `0 A' a
given on the next 6 x% I* S( T9 x5 D
page). / M! d' u( o1 _" U% o* _
In this assignment, you will simulate n
$ o5 W' C/ e- U6 Rsources that uses b5 g! I. a2 \6 q1 Z% C. Q
equation based congestion control to 9 _' F9 O& A8 I3 A
set their transmission rate. From your simulation, you will determine
/ Z- H2 r; ^) J9 ?; Y8 c+ g0 swhether equation based 5 V5 _+ Z# f9 t
congestion
& h* z1 c( T; d, D7 ~+ d% s/ {9 kcontrol is effective in reducing packet loss, and hence congestion.
7 E6 ~, u; L2 K
# h3 S. c! [2 Z- c7 j The above network can then be simulated as follows: 6 X0 x. Y8 K0 s3 e3 b: G& Z
Initialization 5 |, H2 r2 P% M6 [1 W# Z' z
Set the router’s queue size to N, meaning it can hold up to N packets. 5 Z+ i& [6 C# L9 H8 V5 v1 @% e! {
For each sender, set an initial transmission rate, and determine the3 @, ?; A5 N+ k+ H$ ?2 T3 u) m, E1 w
time when the first packet is
0 R) M$ i; b3 { to be generated. - |6 ^6 n- K. X* M
Body
, h8 s; J9 W I: F" L! {8 [ FOR t=1 to SIM_TIME DO 0 Z' A& B3 Y2 H& z. ^
{
6 w$ ^- e2 j8 l4 j" I 1. IF the router’s queue is not empty then dequeue a packet, and
; p( d( T7 F- }; P# D4 J" cenqueue that packet in 3 J1 f" p( {3 B7 n+ q& F
the corresponding receiver’s queue. 9 ?- b4 n& s! P* p+ t8 v
2. IF a sender has a packet to send THEN 2 u/ m( C( p( B" ?! I/ |0 ]
‐ Check if the router’s queue is full. If not, enqueue the sender’s
9 p% y7 ^( h( W" Kpacket. Otherwise,
( [: W5 s& } I9 l0 S discard the packet.
, H0 D; u- o w3 e 3. Determine whether any packet loss rate messages are generated by3 D# ~( W. Q! {& H6 y& S
receivers. If yes, 3 ?2 i5 q, v5 D
then re‐compute the sender’s transmission rate. Determine the new time
/ h0 _- M, |& qwhen the + M9 L5 r! T8 I. J I5 ^; E
next packet will be generated. I.e, t+k, where k is the time interval
$ U* K/ J# c. X7 X8 \until the next packet
3 n" \" O P9 V' t$ z arrives.
8 Q5 y, Y0 j: X, C, R 4. Collect all required statistics.
" j M6 q& d9 [& j }
+ d# O" E, @& G( Z! E In your simulation, collect the (a) queue length over time, (b)1 ^8 a! h7 P8 J u% C, k
average queue length, (c) average + A; }* A* Y9 F) ]3 s: O
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
1 S1 }" j) D7 p/ f% Y# beffect of the following
' c0 d1 |' M) h Y factors: (i) increasing source and receiver pairs, (ii) varying N
6 Y7 n9 \2 g- ^# G5 `% ]3 zvalues, (iii) different packet loss
( ]; T. w2 M! e% C+ r7 @ reporting periods, (iv) loss calculation methods, (v) load p, (vi)
0 Y# W8 k) M$ Jrouter’s transmission rate; 0 I) n7 f" R7 k
instead of one packet per‐tic, try k packets, and (vii) z
0 ^/ j% `4 J2 \) X9 O) H/ }number of new flows
8 N2 @$ t4 y/ N) @arriving at time t . $ t, F! J1 e5 B
' h' ^- V0 z1 e. W* v" R
7 ^7 e) o6 ?3 a6 V/ T" g. y 6 ~; @- B, r; R
Do with sources
7 t, d2 N. J% g7 O& ]9 G5 S7 C# susing a token/leaky bucket to control their transmission rate.
5 ~& p4 M* T3 M7 N7 Z1 I) @8 Z Another difference is that each source has an application that
) K% i1 [. s) Ugenerates bursty traffic, where
6 y, C7 X3 {- J" H R multiple packets arrive in consecutive time intervals. 4 X+ N* ]8 A2 C
To generate bursty traffic, use the following method: 1 L& n% B% x, h+ K
( x$ I0 ?8 G) m& l9 @8 O8 t
) {9 N# U0 S* ? In the diagram above, an application generates a packet when it is in
; t( j5 C, G5 }+ x) j2 c7 I/ u. o- R- Rthe ON state. With ! Q" v/ u+ N0 F& T
probability k, it will transition to the OFF state where it will remain idle. In$ [$ F, w6 q4 N3 o, ^3 c
this state, it has 4 u9 z% v2 p# Z/ O/ m: }+ i- _, ]
probability z of moving back to the ON state.
+ s1 s+ H& w; C4 K+ {+ v The pseudo‐code is as follows: 6 ]+ m2 C" N0 g; M+ t9 \5 R; v
1. Start at a random state: ON/OFF.
4 m" x# Z; O2 } 2. At every simulation tic, do % H: ]8 l+ ~1 q" N J' N
a. Select a random number R in 0<= R <=1.
! ^/ c& o4 n7 l b. If in state=ON
Q0 l7 Y0 T& f( r: aAND R>=k, set state=OFF.
& N( W5 W% l J4 _ c. If in state=OFF AND R>z, set state=ON. 3 l, l# w; o% _4 c( E6 D
d. If state equals ON, generate a packet.
* s0 Z: b* q0 J Design an algorithm to control the token/leaky‐bucket rate of each. t% m2 P- L K6 X) d3 `
source (or all sources - W+ c+ z+ C$ l# Y
simultaneously) such that congestion does not happen. Note, you must0 _3 z1 K5 b" V
experiment with * w, v6 ]& P) V0 `& h9 T% b/ ~
different k( b' h8 A. ?2 r4 G7 K
and z
- r! G0 y8 X" @values and determine
6 s& t3 ?; q5 b1 f. a" `their impact on congestion.
* F8 X) {5 Z& O/ W+ Z, k# ^% u Reference
. w6 e1 L& r9 y+ w; t S. Floyd, M. Handley, J. Padhye,! S5 r" U4 ^; \1 B& }& f2 e
and J. Widmer (2000) Equation-based Congestion Control for Unicast . r3 j q% r+ C
Applications, ACM SIGCOMM, May,
* D* _( } M7 N$ Y2000.
3 y/ r$ n) M: Z( l: A. F$ P
# q: \, H2 P! M1 g: K . W# v. V: W! b, I" p% t1 v% c
|