在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 5 U. Y. L' k! l% Z4 z7 x( \
The risk of congestion collapse on the Internet is becoming a reality9 r" _3 M. K6 p" ~( A
given the increasing number
+ x4 X" H0 {2 M3 }/ y- a8 B' w of audio/video applications that use UDP as their main transport
+ U# h( N1 N- I; S M" w9 J/ rprotocol. Unlike TCP, these ; z% Y3 ^6 j/ R7 _6 B% _
traffic do not respond to congestion signal; i.e., a packet loss. As a
7 a% O6 M7 y! S! v- Eresult, audio/video
: @& F+ I% @4 n/ _- j: T' p applications may take an unfair share of the network bandwidth and
" Q" R; m* x. h3 @( q: ialso cause persistent ! t8 d; |- K2 r) J
congestion. To avoid congestion collapse, the IETF has proposed that
. r& V$ N/ Z( haudio/video applications
- `% W8 F2 s2 M" R5 Q E6 r- r use equation based congestion control (see Lecture‐7 and the reference& t! ~# j8 w& h! F8 G
given on the next
+ G+ j" S4 s2 B' Y: R7 p page). # e0 `, ^& @/ H, u1 u' e- E
In this assignment, you will simulate n
; O; T) K9 k& v) ?# asources that uses& y% _- b6 w9 y+ d: ]2 o. Q" U5 }* Q
equation based congestion control to
0 V5 W( S p% N8 n set their transmission rate. From your simulation, you will determine
* K, T; U; ~8 `6 g$ Lwhether equation based
0 Z( z/ \/ o/ K/ ~7 I congestion- B& E1 D7 D% v. g0 ?! T3 w
control is effective in reducing packet loss, and hence congestion. - K0 Z, m' ]$ w0 n
# G2 \ s' q9 n% g" w The above network can then be simulated as follows: ; D: f+ ~0 A7 C: A
Initialization
% h' k) C/ A& m3 E4 s( |3 H Set the router’s queue size to N, meaning it can hold up to N packets. + n( M/ p* c4 c0 J0 { x3 M
For each sender, set an initial transmission rate, and determine the1 ?0 k: b1 C, W
time when the first packet is ; h* P3 K3 R: N" |
to be generated.
3 d9 c$ u2 A, x C Body
. Y# M0 B. y' v1 H& t FOR t=1 to SIM_TIME DO 6 l6 n D- p) W7 z4 u$ o
{ & W" R: o5 L1 [' H; z
1. IF the router’s queue is not empty then dequeue a packet, and
2 V* \6 O F$ E. Penqueue that packet in
0 t/ h4 M# ^9 \6 V3 ~3 S& n1 Q the corresponding receiver’s queue. + l" N7 l# j: h: q* f5 W8 _+ m
2. IF a sender has a packet to send THEN ) Y7 K: t/ f# B0 W
‐ Check if the router’s queue is full. If not, enqueue the sender’s: ^+ U9 ~% z) b2 L6 E
packet. Otherwise,
9 V, V/ {0 D @2 r0 V discard the packet. * u7 o: J! H2 X- \- @
3. Determine whether any packet loss rate messages are generated by8 m2 S; i3 \6 F' O v
receivers. If yes,
' V8 ^& h" w* w) w. B then re‐compute the sender’s transmission rate. Determine the new time# ]" g3 Y8 o6 \- i1 E# t
when the
" G% i- J3 I0 y6 v0 h9 C# a next packet will be generated. I.e, t+k, where k is the time interval5 F0 g6 W$ N u4 G5 j
until the next packet
- _ m+ U8 [, N' y# Y+ h arrives. . o/ _; a. _* f* ~6 i: t. u
4. Collect all required statistics.
% b4 z& B0 u5 {6 F, ], F, w }
3 V6 d1 |6 m8 N& I7 D6 o$ v2 N, G& p8 S In your simulation, collect the (a) queue length over time, (b)
& o8 ?0 l# z7 P' X% K2 I8 Iaverage queue length, (c) average 5 G2 @% l/ R; w C; _; k4 ^
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
! y: n- E. u' ieffect of the following
! j& j4 N3 y% X6 K; M0 k0 Y' J factors: (i) increasing source and receiver pairs, (ii) varying N+ |: F! H# |- W' d
values, (iii) different packet loss 3 s- Q; R+ P8 x8 o1 T
reporting periods, (iv) loss calculation methods, (v) load p, (vi)& d& o$ O1 L9 p
router’s transmission rate; 6 ^ l( e! }- J3 W. q# p
instead of one packet per‐tic, try k packets, and (vii) z4 ~5 J7 b9 }- |
number of new flows: E0 T/ k8 f% n! y
arriving at time t . ! f" b6 L% v3 n @$ U, f& M
& l% a! B% q/ C: A . e+ N4 U$ S$ s2 N9 U4 }
+ J4 x8 x3 | V, j6 g9 M! l' a9 B/ S7 J
Do with sources
9 z D: z. H7 f2 S9 ?" D! Z, dusing a token/leaky bucket to control their transmission rate. " u2 X4 U3 z& |1 d5 O: O
Another difference is that each source has an application that
( C$ _# e* X: y6 sgenerates bursty traffic, where 5 @4 n, R4 @ s: A: I# _
multiple packets arrive in consecutive time intervals.
4 |2 l4 L2 _9 ?4 }! c7 b To generate bursty traffic, use the following method:
9 C4 u& W. Q% o" x* R# K- g* f 7 u/ x. ?0 W5 e. b; C
# k# h% |/ |4 j5 ~
In the diagram above, an application generates a packet when it is in
" ~! ?2 j3 K5 f* w4 B! A# vthe ON state. With
& W9 N `% i" a$ G. {* v probability k, it will transition to the OFF state where it will remain idle. In& l. h* D8 |) U5 l/ D
this state, it has 9 P; A9 X. d ]$ ?
probability z of moving back to the ON state.
( Z7 L/ _; M2 p. ^4 | The pseudo‐code is as follows: " {" h) c+ L G q
1. Start at a random state: ON/OFF.
- o2 B' K" b& A0 Q, W4 x: T 2. At every simulation tic, do + h- Z3 l2 e1 z( V7 ]& K0 H% t. C Z# {
a. Select a random number R in 0<= R <=1. $ p/ o' O$ E: g4 o3 s. |
b. If in state=ON0 B! p$ I4 E' I% A( L" h
AND R>=k, set state=OFF.
# K7 p o0 b( X' \% V) L) e4 x c. If in state=OFF AND R>z, set state=ON.
: R3 n8 O7 X$ n! r! l- h d. If state equals ON, generate a packet.
) v' c& L" \# R2 d* G6 N: }' g8 K$ { Design an algorithm to control the token/leaky‐bucket rate of each
9 r5 j$ T: d* \7 e. asource (or all sources 3 h- E" C3 K" D. q9 J/ \) g( k
simultaneously) such that congestion does not happen. Note, you must
% |: t" l0 ]5 _ lexperiment with
7 w( _2 f: r$ [3 d( Y. @8 K different k5 I6 p# i; ?7 t" Z r9 F5 c% X8 l2 K
and z
. T9 @0 N5 }8 l; n9 B) ^ n2 bvalues and determine1 k7 b/ i. j% R9 l* i3 v
their impact on congestion.
( P3 c! _% ]/ c/ D. q3 K: d* I- |. e Reference - v9 N5 [% i2 t+ e! L/ w- J# ?" @
S. Floyd, M. Handley, J. Padhye,' ?$ U$ _( q& V) Z# V7 m3 u
and J. Widmer (2000) Equation-based Congestion Control for Unicast . P+ \0 p& X3 r1 u2 u6 x4 V
Applications, ACM SIGCOMM, May,' ]7 X- u- F, q+ u* E
2000. - _0 G- g" P' J5 s4 R
+ M8 a9 S, X- g/ F
3 R6 G: ~# y; w0 W$ {
|