在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 ' b5 J* ~+ ^/ Q% y! i0 H+ W
The risk of congestion collapse on the Internet is becoming a reality f6 N6 f& Q. p: }$ M( J
given the increasing number
& r4 E3 [) V( {" W/ q2 N of audio/video applications that use UDP as their main transport/ x2 Q$ L/ f7 v3 j
protocol. Unlike TCP, these # e; _, W6 ?' h; ?* v. Y
traffic do not respond to congestion signal; i.e., a packet loss. As a
* f% ?# F8 U& A$ L% L) T' _result, audio/video 8 H( n4 G" D( c- s. {4 F) Z
applications may take an unfair share of the network bandwidth and
9 E" F( r7 @. f5 j* r; D9 Nalso cause persistent
5 O% a: k$ Y/ Q: h8 }& ? congestion. To avoid congestion collapse, the IETF has proposed that
( i9 S" j. Z* f7 z0 n! P0 Faudio/video applications ' m# T p0 a) N1 W/ l( p
use equation based congestion control (see Lecture‐7 and the reference L6 y& V9 C5 h7 B" v. s
given on the next
% O* M" e" F0 O9 ]! A page). ' h' P `$ Z& [
In this assignment, you will simulate n7 w" H5 f# [* K+ E v$ k
sources that uses
7 q2 X% E$ q& lequation based congestion control to ' r: x# t) g6 D: m2 d
set their transmission rate. From your simulation, you will determine) v9 `% z. R) @9 t0 J
whether equation based
7 w! P/ }) y1 a: S$ ^) p' o congestion- O7 J' U' M: ~; U, B2 {
control is effective in reducing packet loss, and hence congestion. 6 ~& S! n" b( ^; G5 l" g r" V
( }& v j1 [$ l- X9 K
The above network can then be simulated as follows: 5 s3 g6 o* J) c( }8 v) I3 m
Initialization
8 {( l' s# q( D% m) C7 X T Set the router’s queue size to N, meaning it can hold up to N packets.
; |6 k% W1 X9 }7 n For each sender, set an initial transmission rate, and determine the
4 N6 U1 ` z# k" F4 A: N' F7 Vtime when the first packet is
3 e: U `2 F. b; j& g, Z to be generated.
3 x9 ~& T- u9 T6 H, K Body
: @1 E7 i4 A1 }: _; B9 E FOR t=1 to SIM_TIME DO
/ L2 g; t! l; F/ Z8 _% z8 Y { " T9 |# y3 r% {
1. IF the router’s queue is not empty then dequeue a packet, and
& m# j! o2 S7 T4 [2 b0 e3 Nenqueue that packet in 4 J, O% @/ F8 M! {5 x& |
the corresponding receiver’s queue. & \1 Q. i) \) W$ @$ | G
2. IF a sender has a packet to send THEN ( A, {( f" [; m& S2 I
‐ Check if the router’s queue is full. If not, enqueue the sender’s+ c) C3 n! F- Y' N% D
packet. Otherwise, * M: B5 d: Y, P0 l1 ]' C2 L$ `
discard the packet. - T8 @) i* `8 F- f1 k% B
3. Determine whether any packet loss rate messages are generated by- V: n' z, h8 v3 J5 \! s) j2 O7 G3 g
receivers. If yes, . ]- A3 w) A# u& m; K+ b
then re‐compute the sender’s transmission rate. Determine the new time
1 l; E5 C" t; l9 pwhen the
& \- }6 ~" q g& ~ next packet will be generated. I.e, t+k, where k is the time interval4 X8 f& V. A9 m# J, T* Q
until the next packet 0 u' ~# }3 ^8 n- B6 u& m/ w
arrives.
1 j' h6 I& u$ [7 H+ R 4. Collect all required statistics. " ]. e# U4 h9 p3 I
}
0 Z6 W4 n! w+ p, e+ p In your simulation, collect the (a) queue length over time, (b)
! Y" v8 r& p) W: D2 u' l4 W, vaverage queue length, (c) average / p) c5 O+ |3 q" `
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the- u' [" T! f! k9 {2 w
effect of the following - f" }3 o+ T5 p4 n3 ?; T; y
factors: (i) increasing source and receiver pairs, (ii) varying N# V" z) P: e2 q$ a+ B
values, (iii) different packet loss 3 {+ A% @& ~7 B' V0 v
reporting periods, (iv) loss calculation methods, (v) load p, (vi)+ O8 c2 c g% {
router’s transmission rate; / M% e2 T. ^& j2 ?) L4 H
instead of one packet per‐tic, try k packets, and (vii) z
% u' Y7 h% q( o \6 f; ]9 ynumber of new flows
5 g* C* m$ N- {7 garriving at time t .
& n6 U6 K0 [2 u6 l 5 J* f- h2 w7 Q, a
1 P3 j1 ]2 U" N4 f } ( {1 P0 F% O/ [7 A7 n3 M7 @
Do with sources t' F! z: F; Z! ^% O2 {
using a token/leaky bucket to control their transmission rate. % y% R- K0 a/ X7 s( Z8 J
Another difference is that each source has an application that
& L! g, V0 L# k- R8 M0 |- Sgenerates bursty traffic, where
2 R* e! P4 g; h/ C multiple packets arrive in consecutive time intervals. Z4 g9 q) f7 T" ~8 x- t) A2 _7 P
To generate bursty traffic, use the following method: 1 X: l/ Q7 e+ c
' O" o4 k: r# ], R9 _6 e Y
: O; q. |. M0 v" K* ~
In the diagram above, an application generates a packet when it is in! w7 R! }" N7 [3 w- Z+ M3 \% l
the ON state. With
5 _4 w( ?- X7 Y/ c7 U4 V8 [ probability k, it will transition to the OFF state where it will remain idle. In# ^# X* r+ n" h- }
this state, it has
+ V! `2 n# }0 i- }- ^+ J+ M probability z of moving back to the ON state. $ Q& c! j; q4 `0 `
The pseudo‐code is as follows: 5 g" n: u; d& I& i% B1 R' Z9 h$ U/ ]1 t
1. Start at a random state: ON/OFF. ; n: K4 k' K7 C8 D) A) n5 p( p$ v
2. At every simulation tic, do
- L6 i5 A( e9 M `/ J3 V$ w* A/ ` a. Select a random number R in 0<= R <=1. / u, Y$ I+ m, P
b. If in state=ON
5 H. T; z$ n, X( b# hAND R>=k, set state=OFF.
5 ?6 Q1 a, H8 I: n0 Q' w+ {; C c. If in state=OFF AND R>z, set state=ON. ' C% A; d. [5 t* r3 v2 h
d. If state equals ON, generate a packet. & \ E; d" v6 B a5 z" ?) w
Design an algorithm to control the token/leaky‐bucket rate of each# s$ Z* D: R. @# E$ R* u! K" @
source (or all sources
, x* h0 O: v' M, r simultaneously) such that congestion does not happen. Note, you must
9 M. M* m2 U" E5 m$ r4 Qexperiment with - g0 `% L. D$ j2 o5 Y
different k
1 B: q# T, h- j/ oand z T9 P: O. e. _5 R; R! m
values and determine7 s. D/ g) @0 K3 ^2 a7 ?
their impact on congestion.
! k8 p( C) A6 J8 x Reference
/ v1 y1 [ D! o S. Floyd, M. Handley, J. Padhye,
1 X1 b3 L% Z% y9 cand J. Widmer (2000) Equation-based Congestion Control for Unicast
% d9 ?( }; x$ @# u W8 x$ r# I Applications, ACM SIGCOMM, May,0 X; F$ |$ D$ \. R2 m3 P, Q
2000. ! E4 p, b5 ]) H! b+ W- ]
7 R% M+ Q& j3 y1 s! f3 f
4 ~+ t4 C# {% F6 |" I; E2 \
|