在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 - j8 g0 |2 x$ k2 Z- M
The risk of congestion collapse on the Internet is becoming a reality
( T. f$ H# q* u% [given the increasing number , |$ n, ]) V: X1 ?
of audio/video applications that use UDP as their main transport
3 q2 ^- a ~$ p; s8 U# gprotocol. Unlike TCP, these ( q- O2 ^ q7 B
traffic do not respond to congestion signal; i.e., a packet loss. As a( Z5 |% t, D" P# ~+ N: Q- p$ T4 e8 _
result, audio/video ) F6 q5 T$ x. D; s& Z* f
applications may take an unfair share of the network bandwidth and
& r% h9 ^& X0 L# j% T1 Ialso cause persistent 3 o1 ]1 X6 R* h! l" }" o3 @
congestion. To avoid congestion collapse, the IETF has proposed that. M6 o6 S4 t# b* ^
audio/video applications
1 N: ~5 \; e. ?* R# T8 t use equation based congestion control (see Lecture‐7 and the reference
6 p1 V. V7 z, Y7 @) q! U+ Fgiven on the next
4 F3 M# Y1 W1 Z$ l9 Q page).
& X! z5 Z: y9 i& t2 f9 t In this assignment, you will simulate n
) Y9 N, ?1 U/ [9 P8 w- A2 ~ j4 A1 Ksources that uses
& F1 p4 s$ F; gequation based congestion control to
/ V! m* Y+ H& b( |' f) C9 M1 z: k set their transmission rate. From your simulation, you will determine* u( ?$ O/ f- q: N8 H0 A5 A2 @
whether equation based
6 ]1 n9 w& t; m* M congestion
4 }$ `' g! T) T- U ?control is effective in reducing packet loss, and hence congestion.
: L7 i0 y/ R; R, g; q; _
7 o& Z& `. r9 |4 N5 [# m
The above network can then be simulated as follows:
; y) H: B. ]& W/ g2 h) J) I% _( P Z( F Initialization
' u) x4 s) |- Q2 U5 ~ Set the router’s queue size to N, meaning it can hold up to N packets. - @- m! g7 F$ @1 f' K- a
For each sender, set an initial transmission rate, and determine the" d$ j& p/ V8 Z; D
time when the first packet is + R# S9 x" ?# q8 b
to be generated.
1 h& M" r& N. [; ? Body 0 `6 T) d/ L- R4 ]* Q
FOR t=1 to SIM_TIME DO
5 H* i; G& k# i. H3 \5 { { + K% f# g1 T# w6 R0 D$ o
1. IF the router’s queue is not empty then dequeue a packet, and5 W% K* S! G6 N
enqueue that packet in
5 A3 J6 E1 L* i& @2 A the corresponding receiver’s queue. 4 d9 m c4 H! i; {+ `% o$ N4 i
2. IF a sender has a packet to send THEN
" p7 D- [+ u" R0 u' f ‐ Check if the router’s queue is full. If not, enqueue the sender’s
2 L+ {$ J! ]" K' R5 u. fpacket. Otherwise,
- `; M+ Y- D3 t1 y- X6 _6 ` discard the packet. / A1 |; I3 R( t( P
3. Determine whether any packet loss rate messages are generated by7 z0 J1 x$ X$ ~( z c
receivers. If yes,
0 k7 E& F/ x) o+ s) v then re‐compute the sender’s transmission rate. Determine the new time
9 m8 u4 t1 A( V% s9 K1 i3 gwhen the # I- ^& h$ G+ ]3 U- I
next packet will be generated. I.e, t+k, where k is the time interval, v/ w( j0 E \ |3 w
until the next packet
7 g3 d: H* `" x* b8 S9 @ arrives.
( Z* P) {) P' _# X5 c 4. Collect all required statistics. ! }: f6 l7 x& Q! v. x2 H
} ; [3 J, @2 A9 M# n
In your simulation, collect the (a) queue length over time, (b)) K: L9 |5 s/ z0 E5 H6 @. ~
average queue length, (c) average ' i3 u$ V; y s- ]( n
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
: i6 ?. x- R' V$ @! X% Ceffect of the following * l6 l0 Z& j# Z/ i1 _: @ |6 s" O
factors: (i) increasing source and receiver pairs, (ii) varying N1 ^0 \# X4 G* f
values, (iii) different packet loss
) k8 K8 ~3 J5 d3 D l reporting periods, (iv) loss calculation methods, (v) load p, (vi)2 O# ]5 I9 @! T
router’s transmission rate; 0 ^& q4 C( b6 r8 p
instead of one packet per‐tic, try k packets, and (vii) z
# A4 t: [% y5 F$ Bnumber of new flows
/ z, ^- e8 Y+ K0 A4 E* h' Uarriving at time t . " d F5 Z1 w) y. i" t& p9 h0 H* D
' O7 H+ h. q, e9 W; [
1 n* d, a0 n l6 ^; h
3 n7 p/ G' z0 \: R
Do with sources
; m4 N+ @ S4 C" C# L+ h* m& Lusing a token/leaky bucket to control their transmission rate.
/ X: \, ]# S5 d Another difference is that each source has an application that( Y/ W7 I6 X& R9 Q' V$ W+ i
generates bursty traffic, where + f" l4 |- P& y
multiple packets arrive in consecutive time intervals.
1 U# D& u$ }" T. A8 ^; k0 u To generate bursty traffic, use the following method: ! I" ^; k G) v, G& C4 Y6 Y
# I6 N+ `1 g6 J2 B% p
, X; [8 A/ {! u/ z4 x In the diagram above, an application generates a packet when it is in
( z3 ^5 N+ X8 ?. F' nthe ON state. With
" v7 }6 N0 ^" r8 x probability k, it will transition to the OFF state where it will remain idle. In8 X4 @, H3 w4 v p( Z
this state, it has
6 w" R! S b4 x( V. S# V probability z of moving back to the ON state. 7 C5 y$ M3 M! k+ ]7 M2 m
The pseudo‐code is as follows:
# M( D* n8 J9 U 1. Start at a random state: ON/OFF.
5 j6 X# z# |6 u, W& G* E/ ]& F; e 2. At every simulation tic, do
7 V( } [/ v9 S0 h a. Select a random number R in 0<= R <=1. # I+ t2 Q1 F$ q
b. If in state=ON! Q- H4 N4 _/ @: S: e+ m
AND R>=k, set state=OFF.
+ ?0 ]3 F' B2 V c. If in state=OFF AND R>z, set state=ON.
" P2 D( g6 ~4 K/ J( ~ d. If state equals ON, generate a packet. 8 ]( r. s. \9 h
Design an algorithm to control the token/leaky‐bucket rate of each' w# H+ @% E2 H
source (or all sources
, `! y, s/ l2 X9 P* o7 g G simultaneously) such that congestion does not happen. Note, you must
; {- z7 Z: T0 N: S* g) ]% Mexperiment with ! I8 |2 [2 R1 F
different k& k; Q9 p7 }" v+ [/ N! @; Q v2 @
and z
/ Q, h& s' c, p# p9 X6 _* ~values and determine! d4 X" x+ Q# g+ e
their impact on congestion. . r: ?+ `$ T( @9 ^5 [, [5 C
Reference
& `5 D; V" q1 ~" b: b S. Floyd, M. Handley, J. Padhye,
4 Y7 h0 g1 X- J6 {+ g9 Xand J. Widmer (2000) Equation-based Congestion Control for Unicast
% M, v5 @% n: A0 N Applications, ACM SIGCOMM, May,, O9 G% ~7 K g/ m w7 x- h
2000.
' U+ Z) F" q' K$ \' a
/ Q9 L% J3 j# s% G; T 2 \0 n i) @8 _( e' I& F
|