在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 H9 n1 e& U- |+ N# Y% b5 P
The risk of congestion collapse on the Internet is becoming a reality
* i1 A3 C4 v4 Q9 }given the increasing number - V3 w7 \2 k3 x4 R3 E
of audio/video applications that use UDP as their main transport
( }; f8 m/ z4 \protocol. Unlike TCP, these
/ Z4 i: t# E# n" Z traffic do not respond to congestion signal; i.e., a packet loss. As a# n4 s* J/ R% v$ q0 G
result, audio/video
" n/ A3 D! c4 Y# {! `; w- n+ z% n applications may take an unfair share of the network bandwidth and c- o9 \" ^3 X; e' c0 J
also cause persistent
3 e; i: J# k7 }4 M+ v congestion. To avoid congestion collapse, the IETF has proposed that. C7 V# i$ z" l; l) G
audio/video applications
5 [& m% m9 R9 a, I; u4 I use equation based congestion control (see Lecture‐7 and the reference
. h2 g: I. d8 v; ]; [5 Dgiven on the next / V5 t) V1 b9 u# @$ K0 ]
page).
& X) l% |. {' v% _" I In this assignment, you will simulate n# C( T l7 f# c( y3 H w4 P
sources that uses
. I' i& s9 l7 E# S+ ]4 dequation based congestion control to
; |( A) Y% ~# E( u6 l set their transmission rate. From your simulation, you will determine
5 w+ D0 B( r0 Swhether equation based + H& J$ A/ D: s' M% F/ i1 w9 R
congestion$ c4 N; i g, r1 R4 k6 k/ c$ B
control is effective in reducing packet loss, and hence congestion.
. @" E% v+ V7 j* `; R
: e5 u* l) h4 @) A# i
The above network can then be simulated as follows: , w0 p" P2 {9 Y% M* `
Initialization
6 z! f5 D$ Y5 j- A. O' v, Y! e Set the router’s queue size to N, meaning it can hold up to N packets. 3 `9 l+ ]! t5 Q7 I7 h" F
For each sender, set an initial transmission rate, and determine the9 X( Y2 g: q, `& P
time when the first packet is
( k, E- Y, x% n: B3 o; e to be generated.
6 C) ^2 m( b" ~$ t3 H Body ; H+ {. A; q* @& u/ L& F
FOR t=1 to SIM_TIME DO 7 X! C% k& b" N2 Z' U9 X
{ ! @7 m7 U; p9 p" ` h$ k3 a* n
1. IF the router’s queue is not empty then dequeue a packet, and
3 ?/ Y( g# Q* I" N, [1 q8 ~enqueue that packet in 6 }) ^+ D4 X ` @0 ^8 F6 ~1 Q
the corresponding receiver’s queue. 6 t F8 [- c& @/ M
2. IF a sender has a packet to send THEN
* v5 I# c- A ~2 m8 O' F ‐ Check if the router’s queue is full. If not, enqueue the sender’s7 V1 d& Q: d1 U, [; I1 W
packet. Otherwise,
5 m' s! t1 r. x6 s9 b( M discard the packet.
& O* b7 ?0 K$ O+ k& l 3. Determine whether any packet loss rate messages are generated by( X2 |. j% Y. c# r8 U
receivers. If yes,
2 p2 u* O9 D* z+ @ x then re‐compute the sender’s transmission rate. Determine the new time/ }$ n+ q. `& t
when the
3 m; v S0 k+ \8 N0 \' ^/ i next packet will be generated. I.e, t+k, where k is the time interval
+ L/ `& D: \* U$ \' u3 iuntil the next packet
* ]; T+ f1 ^" x, [& X { arrives.
0 X% H+ N; O/ b- m 4. Collect all required statistics. " u; p" q' k6 h! L( o; S+ P0 {0 w+ j
}
" }3 V6 q, U! I, M2 g' I0 ]. ` In your simulation, collect the (a) queue length over time, (b)# i! D+ j y5 m1 G
average queue length, (c) average
% D1 C n) t. A) S end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the' U- ?8 M# k: s6 j$ o9 O; z
effect of the following & {& K1 e9 ~' z: l
factors: (i) increasing source and receiver pairs, (ii) varying N
$ |& \. k- `' z& H4 r- }3 Rvalues, (iii) different packet loss 2 ?6 I8 ]5 D' ^; w3 V2 j* E
reporting periods, (iv) loss calculation methods, (v) load p, (vi)
6 \2 T1 } f& s1 ~' T# H3 G7 Jrouter’s transmission rate; # H2 h" W" V( I- Q+ p
instead of one packet per‐tic, try k packets, and (vii) z
) F( `0 [6 I; W! |' H( k) X7 N+ tnumber of new flows
# S( R# L& d8 N0 i8 v( U" ~arriving at time t .
8 h( C: ]2 Z; h( v 2 o/ i3 B1 {2 {- `% `
6 D& b: i. a, P, T- \$ ]' _2 Y5 E 6 {4 Q2 z% d6 b4 p" s1 x
Do with sources
" N4 M I# m2 L' \0 e9 M% b( r1 R7 Y" Z( ^using a token/leaky bucket to control their transmission rate. % C' K6 e' _9 {7 |/ Z
Another difference is that each source has an application that
9 k( z) @( Q9 n' fgenerates bursty traffic, where Z( ~0 f* f g- X" M- T- f& a
multiple packets arrive in consecutive time intervals. 4 d6 d7 ^2 U- ]( V) J
To generate bursty traffic, use the following method: # o4 y( }3 K2 B7 c2 H6 J
+ b$ M% d1 R9 {6 P/ O* z* j
% v' `8 f8 ]* D, v! K In the diagram above, an application generates a packet when it is in8 E0 z$ ?4 s" b
the ON state. With
6 }; J9 A& `7 D1 d1 j D probability k, it will transition to the OFF state where it will remain idle. In
/ \0 Q4 Z2 k' }, s$ e6 _$ p7 Cthis state, it has
7 _+ q1 e* S! |. F( { probability z of moving back to the ON state.
2 @, i. o" a0 |$ f4 C- W: X% C The pseudo‐code is as follows: 7 d) P, D, U* }0 T" n
1. Start at a random state: ON/OFF. + p( r0 E/ R% d9 {! h& ^
2. At every simulation tic, do % \! N( @1 P- c& M# j
a. Select a random number R in 0<= R <=1.
" P, f# A' P' ^: c, M, w) H# z7 {4 B b. If in state=ON
: f5 E( Q2 _' |. b% B7 C/ E9 pAND R>=k, set state=OFF.
/ {3 o( [, e7 |9 u8 |8 x; K+ }# v( B( j c. If in state=OFF AND R>z, set state=ON. . ^' o3 ~4 c0 P8 f7 j
d. If state equals ON, generate a packet.
% P d8 C/ J- `( U: `. I Design an algorithm to control the token/leaky‐bucket rate of each& x2 ^5 t/ r# t+ _% L
source (or all sources
4 N! _( G2 j5 }( H$ a' l) }7 l# p simultaneously) such that congestion does not happen. Note, you must8 f$ q6 s6 \7 f
experiment with
( m" k+ i" Q. B; M+ f$ o different k
' e( L* v+ W- q5 `6 z/ P* xand z0 s- Q+ E1 h; x6 Z; [/ W
values and determine7 _( m) S: U' z( ?3 Y [
their impact on congestion. ) K8 O0 N! k$ S) A, i T* [
Reference
, s* {7 d" U3 ]( g/ `! v S. Floyd, M. Handley, J. Padhye,
a [0 ~6 J4 q" N& t) ~and J. Widmer (2000) Equation-based Congestion Control for Unicast / W v9 x6 x- M1 |
Applications, ACM SIGCOMM, May,/ q/ W9 k: ]) ~& n# I8 ~. { b
2000.
, C" @6 W9 R9 F. Y! _
. q$ @* q9 u" @- j- h$ W N/ W% [ @
* b' ?8 _1 C2 E
|