在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 ; u, ^ c- q2 f5 _& w
The risk of congestion collapse on the Internet is becoming a reality9 O9 ]. c( A1 j
given the increasing number
2 L" _% j0 d" a- | of audio/video applications that use UDP as their main transport
$ x- \. j, D2 d6 }1 I+ ^: _protocol. Unlike TCP, these
, I& w9 i1 P- L5 Q7 e- b G4 n traffic do not respond to congestion signal; i.e., a packet loss. As a
- z; N# r1 F. L+ l! D1 X/ H6 Q4 M7 Aresult, audio/video
m6 L$ L7 ^1 M' D) h$ H J applications may take an unfair share of the network bandwidth and. Q# E$ g" c- M* ~+ c# g- ]& q
also cause persistent # k* z3 N0 I/ y% K
congestion. To avoid congestion collapse, the IETF has proposed that
; G$ w; ?5 ^. l: K0 T/ w" E4 iaudio/video applications
2 ?- H& o0 D( j8 \, ^: c use equation based congestion control (see Lecture‐7 and the reference2 K h: ]" \" x
given on the next / ~0 ]6 e! s# P# A- `- j; f) E
page). " h$ |/ s8 [. _- {
In this assignment, you will simulate n
6 X1 r5 C$ j( Nsources that uses
1 C7 X n- u3 _/ _' X1 i8 Cequation based congestion control to ; X* p9 A% M/ X- R+ y$ h
set their transmission rate. From your simulation, you will determine
, W* U" O' c# P+ zwhether equation based
# d8 O* J) f' ? l- X% A congestion
% G/ S0 m' V7 F6 @/ ~8 |- P) z- G+ Jcontrol is effective in reducing packet loss, and hence congestion.
0 L% c3 r. p3 c0 \
9 I2 }3 ]4 d; c1 g& Q( _' A {
The above network can then be simulated as follows: 0 ~4 i7 s. ?2 j+ u
Initialization
! [* s8 \+ x6 X0 c% d Set the router’s queue size to N, meaning it can hold up to N packets. 5 [. w% P8 L, Q: B( X- {. r' B& ]4 c
For each sender, set an initial transmission rate, and determine the% \& J8 ^7 h0 ?8 \: i1 O$ E- }( n
time when the first packet is , N& E8 c3 q0 N% C
to be generated.
, R/ o2 J; Y6 A Body ( @# |- ^1 r9 j6 h8 Z4 l! X3 Q. b; `
FOR t=1 to SIM_TIME DO # N! ~- L0 Y6 `- B5 J1 Z/ x( W
{ + R, m0 Y1 B, E
1. IF the router’s queue is not empty then dequeue a packet, and# T9 B/ S C5 x4 K5 _- C8 P
enqueue that packet in : f# M: U% {$ j8 ]4 \) p; ?3 U
the corresponding receiver’s queue. 9 G" P, h- ^- v
2. IF a sender has a packet to send THEN
& |$ N- K4 n0 j( H/ c6 k$ K6 |1 _ ‐ Check if the router’s queue is full. If not, enqueue the sender’s
4 h" {$ T) T# f& p1 {, ?0 |packet. Otherwise,
- d2 [8 G" a6 C discard the packet.
# ?9 @( N8 |; _# C% M( c, L 3. Determine whether any packet loss rate messages are generated by
; H" p# H2 L1 A9 O: _receivers. If yes,
, @7 R2 L# e) I; ^0 W then re‐compute the sender’s transmission rate. Determine the new time% |# C' F. S! y& }
when the
# ^6 w, K; w, x3 i+ S3 }1 q next packet will be generated. I.e, t+k, where k is the time interval
+ _! v1 B6 \4 \1 g" P, N8 [; xuntil the next packet
0 @1 D7 ]5 w/ j x. B$ { arrives. 3 W1 V8 R; S$ [6 X: {/ [* q9 m
4. Collect all required statistics. ( L5 u+ O" R7 n) v1 x& A) c& [
}
$ h: V; H* ^8 A$ { In your simulation, collect the (a) queue length over time, (b)" s; X/ G3 Z5 ?, s& d0 n% L
average queue length, (c) average
0 M' v, X7 u. m0 K" Z end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the K/ `$ b& B8 p; q2 |, r+ t
effect of the following
# w7 u4 |$ D( u3 o. p' l factors: (i) increasing source and receiver pairs, (ii) varying N
f+ ]4 h% S1 _! Ovalues, (iii) different packet loss
- _ U8 y0 s5 ~4 h& b reporting periods, (iv) loss calculation methods, (v) load p, (vi)! k+ X4 f. X- d0 q. p# A
router’s transmission rate; ' J# E* b! W4 F9 m! {3 t
instead of one packet per‐tic, try k packets, and (vii) z
/ W% v2 Z" n% }4 Rnumber of new flows
J& Y, @# l3 `arriving at time t . 6 i7 n: {+ }+ D5 _- Y
& j. j% t! M, _
* `( M& w2 J0 h
% m5 i0 \6 J9 ~- X% C/ Y Do with sources; c- `. D, t) n2 W
using a token/leaky bucket to control their transmission rate.
6 g; D6 y; Z1 o" C, P Another difference is that each source has an application that. q6 \6 [$ R) E- S/ i% E( T
generates bursty traffic, where
2 j9 ^8 x- K+ r multiple packets arrive in consecutive time intervals.
* p; r2 r9 y$ a6 r @( U To generate bursty traffic, use the following method: 4 r1 W1 z2 R ~; H3 }. u
( W0 o( ^( U( ?# i
0 W: S! r3 H( D3 V M6 ^
In the diagram above, an application generates a packet when it is in+ ]* ]+ K! E& x$ M% f
the ON state. With 1 n! G& `/ |. q# W) j S! p
probability k, it will transition to the OFF state where it will remain idle. In
& x* v8 x8 ]7 D% K0 z5 ]this state, it has 1 b5 Y$ b* P( h, O$ o
probability z of moving back to the ON state.
& Z% }. }6 G$ J. ~) a, s: ]# Q1 m The pseudo‐code is as follows: % A2 W( q* u3 H3 G, T7 ~1 i0 \
1. Start at a random state: ON/OFF. 2 G$ [, P- g# H8 z) \
2. At every simulation tic, do * ]- s' X/ j& x! \" L
a. Select a random number R in 0<= R <=1.
* B1 b4 f0 g& S8 q* H) P b. If in state=ON$ w/ P4 K9 Q" w* i, P+ r5 ?
AND R>=k, set state=OFF.
- _+ U* u4 ]7 A c. If in state=OFF AND R>z, set state=ON.
+ ?$ f/ E2 z4 P K5 r d. If state equals ON, generate a packet.
3 l% ^2 @6 v8 w4 u5 z Design an algorithm to control the token/leaky‐bucket rate of each
, k: @; h E" P+ Zsource (or all sources
7 s% ]1 K$ b9 S0 \ simultaneously) such that congestion does not happen. Note, you must* N4 ^) a2 @' q% u' h$ B. j
experiment with ; M: H5 E+ [7 X! n/ L* b
different k
( z. ~! j; U6 Z. w7 i1 v" ]( iand z
) Z7 u' J. r* q8 m$ g- L3 Zvalues and determine
5 p) B3 x# W; ^/ [ N7 K* q% m; }3 A. Ftheir impact on congestion. . \4 p0 H5 i& ]$ L; A- W
Reference
( C+ w3 ]% A) p S. Floyd, M. Handley, J. Padhye,) a& ~) E0 Y$ u! r
and J. Widmer (2000) Equation-based Congestion Control for Unicast
' _3 G- f6 G1 ?( d3 U: A9 u Applications, ACM SIGCOMM, May,
& C' X8 c0 j p" [3 K% W1 i- t' m2000.
& I8 k# A( N! k# b+ u2 P 3 P% A) b, L5 y9 o4 r
& x5 A4 l' V: {2 w1 U! c
|