在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 4 y$ Y g8 ?* L) n& w
The risk of congestion collapse on the Internet is becoming a reality
- U9 u* z7 H) Xgiven the increasing number
9 m& I1 A B+ ]3 N of audio/video applications that use UDP as their main transport+ ]9 P$ s/ m! p" s: N2 u) b: b
protocol. Unlike TCP, these
5 I: _. j, W: G+ K7 n& O8 V, M traffic do not respond to congestion signal; i.e., a packet loss. As a
' ^( Y \+ Z8 A' I: m% v1 Sresult, audio/video 0 ?3 H$ z4 c* E5 s- J
applications may take an unfair share of the network bandwidth and- @- b8 Z. x& @$ H2 T% x
also cause persistent
m! j; B K+ D congestion. To avoid congestion collapse, the IETF has proposed that
2 {# d$ q' m* N& M& U& a v9 ^audio/video applications
) N3 `( J: b4 ?7 x& t9 b6 W! M* @ use equation based congestion control (see Lecture‐7 and the reference7 V8 C. L5 i$ _( }* T2 [, |
given on the next
. y& ]6 U K4 z1 m- @) x9 B page).
! c5 t q, p, U5 Y In this assignment, you will simulate n
# j; A0 ^7 P8 ~2 E3 Wsources that uses/ g/ }- A& l- C! L
equation based congestion control to C( c6 ?2 d1 d
set their transmission rate. From your simulation, you will determine# }6 H: D% C% ?0 q% z. ~
whether equation based
2 u: W3 w( ?- Q7 W/ W2 p. ] congestion& m! i5 K1 e3 M' N/ Y% q; o
control is effective in reducing packet loss, and hence congestion.
/ I+ P; _, }. K. ?
( o* s4 Y0 w8 _8 u+ Q) O$ `4 h The above network can then be simulated as follows:
$ j2 L5 u, K2 |) q/ o Initialization 7 V0 P" H$ C. x: J4 N7 Q
Set the router’s queue size to N, meaning it can hold up to N packets.
) N9 i4 d0 z: E For each sender, set an initial transmission rate, and determine the
' I& \% K- @3 k% etime when the first packet is
% h- l! f0 a4 t to be generated. 9 I4 V: Q2 z+ x/ w6 I/ x, i! c- I
Body
; u1 o: U6 S( n, W; E3 J7 V* z FOR t=1 to SIM_TIME DO ( e9 J6 b4 S: P6 z8 ^2 D
{ ' `# v" q4 {# o9 q2 l
1. IF the router’s queue is not empty then dequeue a packet, and
5 o1 e4 e; z7 q' wenqueue that packet in
9 ]2 ?. E9 [- ^! i3 n7 e the corresponding receiver’s queue.
/ T9 T2 U( @; g- F! P3 L3 M ^1 O1 Q 2. IF a sender has a packet to send THEN
! c+ {8 g# b3 k$ Q2 R% n ‐ Check if the router’s queue is full. If not, enqueue the sender’s
# y3 V* l" n# \6 P" u6 |* }packet. Otherwise,
- N# Q7 }$ D6 ]' z0 |8 B discard the packet.
- E: r. [' R" f: _+ D1 d- f% z$ H 3. Determine whether any packet loss rate messages are generated by3 b$ E! B: b: f% m4 U0 a0 m
receivers. If yes, 0 I1 i! f" v5 m) I: N. E
then re‐compute the sender’s transmission rate. Determine the new time- j+ U+ n h/ W7 l( W# \+ {
when the
4 X2 \* N, `' n" E next packet will be generated. I.e, t+k, where k is the time interval
/ h; w) V! l' a. ?until the next packet
2 u: z- B( E3 q3 z9 I5 L* L arrives.
# H5 K4 ?& k7 Q* ? 4. Collect all required statistics.
7 c1 p5 B; l: t- Z. s f } ! n2 L! @& S- h) ?6 |6 \# j a7 O; c; k
In your simulation, collect the (a) queue length over time, (b)' n) X0 c3 S, z0 ~+ L
average queue length, (c) average . v- s, |0 w# G
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
4 {9 l. A, \2 K4 o4 ueffect of the following 1 J; I* H* E+ x7 G
factors: (i) increasing source and receiver pairs, (ii) varying N
! c0 O6 R- R; ]4 bvalues, (iii) different packet loss # {0 x" v2 K7 c% `( J9 G$ v
reporting periods, (iv) loss calculation methods, (v) load p, (vi)
: @# A" X" p: [$ k2 g; E: ^+ K, O$ krouter’s transmission rate;
- W- h! ^& j: q, R3 b5 D+ M( u' } instead of one packet per‐tic, try k packets, and (vii) z! i. J9 _! u+ S L J+ i
number of new flows
8 z7 b3 ?8 k' Aarriving at time t . # i7 S" |- c7 T) F: B2 f
/ c8 M4 S8 A. T6 G7 N
5 r3 h( O7 ]' e6 G
b! L( V/ W1 b- v: e% u Do with sources
: l! {+ k; b/ musing a token/leaky bucket to control their transmission rate. 0 B+ W: f5 w+ ]- j& u+ b
Another difference is that each source has an application that# O6 j7 M, V4 }( R# ^% h5 T" Y
generates bursty traffic, where
@" r9 p! U& U! e0 ^ multiple packets arrive in consecutive time intervals.
; b' Y) P! }. D5 g+ J& D A0 U4 ] To generate bursty traffic, use the following method: - z- } C4 h6 r
0 A/ O9 X! I6 L+ h0 x
6 C ?6 V: y7 ?! p In the diagram above, an application generates a packet when it is in
* c4 i" {7 E: q) c% Tthe ON state. With 9 m* A( H2 f5 z; i( x+ @0 |; d
probability k, it will transition to the OFF state where it will remain idle. In1 l7 Q# y2 O: p* f% Y- {
this state, it has 9 S3 p. }, j# S+ L' M
probability z of moving back to the ON state.
* W4 ?6 j$ h; [* |- J- U. `# e: c The pseudo‐code is as follows: # n- {3 k* E; ?. X5 ?2 B
1. Start at a random state: ON/OFF.
, A5 t. I$ T; ~' I/ R 2. At every simulation tic, do
: g: |: b) ^) M( {( F a. Select a random number R in 0<= R <=1.
# ]; c+ g8 Z# d" y b. If in state=ON& Z" V( V& W' h! h3 |1 r
AND R>=k, set state=OFF.
1 @7 P. o* M! k c. If in state=OFF AND R>z, set state=ON. * }$ q( q9 m8 R& P X
d. If state equals ON, generate a packet. 6 n! _% @( T! ]) x% R6 ?
Design an algorithm to control the token/leaky‐bucket rate of each
2 @8 M& c: w/ Y3 @0 z6 r% Gsource (or all sources
/ X4 H: c* p2 Y4 I: Q simultaneously) such that congestion does not happen. Note, you must
, j0 }+ d: R% jexperiment with - o( V8 v ?- r# ]2 @ v! _0 K
different k/ [ S+ `" H2 v& D
and z4 |. N* v( ]$ D$ g
values and determine& C. v- r% G- g; j, Q
their impact on congestion. ! ^% Y4 c% i( \0 Q1 {& w& [1 A
Reference 8 m' [% z0 s+ D( R9 l! h
S. Floyd, M. Handley, J. Padhye,; B |/ i, E' b, w% }( C! H1 D
and J. Widmer (2000) Equation-based Congestion Control for Unicast
( c# \+ X7 B; {% `/ F2 ^ J2 ]4 T Applications, ACM SIGCOMM, May,5 T0 ?8 I0 F/ `# Y" Q) i
2000. A9 b% }( K% J Y# \# H, |" w
2 C6 e. c: P0 W# j8 F
1 c8 {9 Z! E; P1 R( ]1 e" j0 k
|