在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 2 E- u5 y% ^( e* w" w
The risk of congestion collapse on the Internet is becoming a reality
2 H; s8 Y; X) @5 J* \' J; ggiven the increasing number
( j2 S/ g, _& Z/ p: H of audio/video applications that use UDP as their main transport
% [$ D5 }; W/ s2 x1 B# wprotocol. Unlike TCP, these # t2 u% A9 g. s. t+ I! D+ i
traffic do not respond to congestion signal; i.e., a packet loss. As a, c2 d8 {( a+ Y+ z: B
result, audio/video - E: A% ?6 a1 S( q7 y( D4 N
applications may take an unfair share of the network bandwidth and
8 ~7 L, H8 ^2 V% d5 H i3 Y' [also cause persistent
, N3 u$ x% U9 m: j* n9 i% P congestion. To avoid congestion collapse, the IETF has proposed that
9 N- E' e2 W# @+ }% g1 e2 I1 z+ Faudio/video applications ( d3 @: P) T) U% d6 ^
use equation based congestion control (see Lecture‐7 and the reference
/ w2 X" `8 F5 B* W, b5 T p3 Zgiven on the next 5 t+ f: @- O! V5 U8 q
page). # k7 j- C# K% S+ p [4 @
In this assignment, you will simulate n
2 I3 Z2 R7 Z" K, w+ U% psources that uses- L# E+ z8 R9 U$ d
equation based congestion control to
& L- x0 `+ i% Z# H set their transmission rate. From your simulation, you will determine
/ X' q3 ]* c. [5 Ewhether equation based 1 t. ?3 d2 {. y6 Y# d3 ~. B# `, \
congestion
8 r8 V+ I* ~6 H$ u" Bcontrol is effective in reducing packet loss, and hence congestion.
9 h- S: P, I5 k; ?- T
$ ]0 W( C. u# z. ^' g
The above network can then be simulated as follows:
; g% T7 Z5 O1 i& L3 H9 ^ Initialization
/ R$ n' Q+ `* r Set the router’s queue size to N, meaning it can hold up to N packets.
0 K, v, k1 r+ L For each sender, set an initial transmission rate, and determine the% ]/ ?* `7 p* A
time when the first packet is 5 q( ]* A4 f) e U5 I2 h
to be generated.
" Q; @, Y2 x; x6 H; P6 L Body
7 O( L! \: @1 m5 c' m FOR t=1 to SIM_TIME DO + E |9 r8 Y2 {; X" K
{
; H) K9 L& Q3 n7 z [: ^ 1. IF the router’s queue is not empty then dequeue a packet, and: N+ F2 ~# v4 \ o7 L% P; g
enqueue that packet in 8 E& b& Y$ ]) x( A& _/ K7 J
the corresponding receiver’s queue.
3 v" F k5 V7 e6 i# b 2. IF a sender has a packet to send THEN
9 ?' g6 ?0 i8 {* D! ~2 S ‐ Check if the router’s queue is full. If not, enqueue the sender’s; z9 f! i3 |; b4 S! n Y
packet. Otherwise, 8 E w$ [5 C* m3 }0 z8 i/ p; S& j* V
discard the packet. $ p, c- N7 J1 i. f3 ^ h! ^
3. Determine whether any packet loss rate messages are generated by
6 w( N! M' V7 n( g! Ureceivers. If yes,
2 u5 @* A7 f$ N9 X+ `/ A then re‐compute the sender’s transmission rate. Determine the new time
# F o3 O3 G- E% g cwhen the
3 Z0 H2 B+ t% Q, `2 o next packet will be generated. I.e, t+k, where k is the time interval
! Y+ h# d( |( `! n: zuntil the next packet
- E* }3 A+ Z* m2 ~, C$ ~6 ~: h2 C arrives.
7 a, s3 q% f) a5 Z; A 4. Collect all required statistics. 1 v# H. k) r: v$ I6 Z
} ; w' Y0 Z! {4 }0 _
In your simulation, collect the (a) queue length over time, (b)
. @& `/ }; T0 saverage queue length, (c) average * Q0 d/ o% t5 p A2 Y
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
, r0 W6 F3 ~) [7 leffect of the following
# X% r) \* f0 f factors: (i) increasing source and receiver pairs, (ii) varying N
* _/ n" A. u; d! i7 m. Jvalues, (iii) different packet loss
4 E$ F8 ^ o) ]" z reporting periods, (iv) loss calculation methods, (v) load p, (vi)" Z0 f; F* {) L" X8 T9 I# \
router’s transmission rate;
" k5 z' }# J4 u" e instead of one packet per‐tic, try k packets, and (vii) z
4 z. s0 w4 w; Z* b/ e; p; ?number of new flows! v; c4 N& w* S( ~# q. z1 [
arriving at time t .
8 r; R3 @0 @0 t2 P. Q 0 V( W) C3 D. ~& n' E/ U3 [5 l
( F. Q& P! \( f; V: O8 b
; x8 Z: {% n* o) ` Do with sources% r; l* m9 S8 X4 G: d. Z6 l% [
using a token/leaky bucket to control their transmission rate.
, P2 Z3 l- @* N6 G% x' E) S* a Another difference is that each source has an application that5 C" `1 e* ?' J# A5 R& n
generates bursty traffic, where 0 X# A p7 N6 a
multiple packets arrive in consecutive time intervals. V% S0 U& H2 | N i3 m
To generate bursty traffic, use the following method: ; ?7 V8 K- \" c6 h4 A+ q
( X9 T& `" }& g. H4 ? 4 V& U! y9 V1 O- ~5 D$ @- g
In the diagram above, an application generates a packet when it is in
( v l# b: ]" J& K& R" pthe ON state. With
+ L! `* m; Y: E% s probability k, it will transition to the OFF state where it will remain idle. In
3 s4 a7 e" J- ^- ]6 ^& T8 Nthis state, it has " o7 `3 T8 T% l! Y
probability z of moving back to the ON state. 1 a: Z9 s2 M/ b/ [+ f5 f. Y+ x; H
The pseudo‐code is as follows:
- H! {4 a$ f2 ^$ B 1. Start at a random state: ON/OFF. / m1 [# t3 O* }4 x3 O9 w: V
2. At every simulation tic, do
0 G' \ v8 z1 Y' F7 r. s a. Select a random number R in 0<= R <=1.
, q8 a$ {6 q$ S6 f b. If in state=ON
: {' I: }7 W0 w: W% D% yAND R>=k, set state=OFF. + X+ _3 l0 N) V# [. k" G3 P7 u4 k
c. If in state=OFF AND R>z, set state=ON.
1 R3 X. U/ k. `- Z d. If state equals ON, generate a packet.
5 a" u: u3 I2 K4 @ Design an algorithm to control the token/leaky‐bucket rate of each8 ~: R7 z- V: `* p& z6 F; M2 s
source (or all sources , E" H1 c+ C) R! M l
simultaneously) such that congestion does not happen. Note, you must
: E, R6 y( U! z: Q6 Iexperiment with
: @$ n: K8 [1 V4 i: Y different k
' J# C; V4 H! }/ L5 g6 c6 s2 I# Iand z# ~5 E: I6 P' J* H/ ~; r$ H
values and determine
1 o2 K1 A# N7 P+ T: ^* v5 D; `7 ltheir impact on congestion.
8 x a0 z" V. ]+ I* V Reference
e/ R; r4 C4 O7 \: L S. Floyd, M. Handley, J. Padhye,
* T' W, S# K+ v4 C& f- g/ gand J. Widmer (2000) Equation-based Congestion Control for Unicast
, A' _+ U4 N1 g, _% ?6 c1 A8 i Applications, ACM SIGCOMM, May,- T9 @9 N9 Q8 ~! A* G1 T+ b
2000.
' \( D( O' \1 n' z! c
/ `/ w* J! L1 G3 h( J% f
* ^* U* G5 l5 H; r j
|