在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下
" v. x$ \' ]% _/ K: m8 X7 k The risk of congestion collapse on the Internet is becoming a reality
4 g8 u$ f5 X4 m# s* ~1 `9 `given the increasing number 9 d3 l* w. l) x% e: A" f; R
of audio/video applications that use UDP as their main transport2 q; Z) W9 z! U' Q1 Q6 o; I& v
protocol. Unlike TCP, these
4 `9 D* w9 D! h0 i! w. ]" ? traffic do not respond to congestion signal; i.e., a packet loss. As a
9 a" \8 }. T; U( `result, audio/video * f e. z. W1 ]1 j3 N
applications may take an unfair share of the network bandwidth and8 M( _# @. A) ^
also cause persistent ! s# e4 F1 i( \/ e+ A
congestion. To avoid congestion collapse, the IETF has proposed that0 x4 I, m6 J u4 d- M
audio/video applications 2 T i, i7 Y; d# N$ m, G( \
use equation based congestion control (see Lecture‐7 and the reference2 C+ G# _5 N( T7 [
given on the next 0 n5 C+ u- k9 P4 _& F* K
page). 3 K; F0 ^1 g2 z2 S3 {
In this assignment, you will simulate n
3 X% T1 I# J Z" p0 ysources that uses
2 R, \9 L% S" ]9 ^equation based congestion control to 0 @! ?' b/ {6 f! ^
set their transmission rate. From your simulation, you will determine
3 s5 ?- }2 @3 N% Swhether equation based
: l9 f) U% J$ G' t congestion! |" w7 y! Y5 b3 J4 ?
control is effective in reducing packet loss, and hence congestion. * ^/ F0 }- I2 E6 Z4 k
" C/ n) [' q) o
The above network can then be simulated as follows: . @" v% A8 K! i" W
Initialization ! B) f% [/ Q% f, x$ G; B
Set the router’s queue size to N, meaning it can hold up to N packets.
3 u0 \# L8 M- u, f4 I For each sender, set an initial transmission rate, and determine the
' e# W, ~8 ]; ?; M% ?time when the first packet is : k( d0 v. h" R0 {
to be generated. 5 o. y$ l* l+ y
Body
! s2 J5 e: L7 g' B- `; c FOR t=1 to SIM_TIME DO . h8 F4 R2 x5 d0 @9 N$ O2 k
{ ( R% R; F# N1 b: t6 `/ M
1. IF the router’s queue is not empty then dequeue a packet, and
% `. k. z- q9 Y. A( Benqueue that packet in
: C5 w0 ?6 F: l9 G- j8 h, n! L the corresponding receiver’s queue.
6 R6 C( ]# Y. s- Y1 c 2. IF a sender has a packet to send THEN
0 _) M, A) c% A8 e5 f' O& v( [# { ‐ Check if the router’s queue is full. If not, enqueue the sender’s
; S: c% q; {* F5 j' n/ ^packet. Otherwise,
+ Q) m5 z3 c0 I2 L+ Z C8 c- ] discard the packet. 5 g# g. [. @1 g7 c, _3 O
3. Determine whether any packet loss rate messages are generated by
# k7 j0 w. @! b5 v6 i$ G+ lreceivers. If yes,
) S& t$ ]1 P4 I. b0 h+ n) y! ~) f then re‐compute the sender’s transmission rate. Determine the new time9 p9 ]* n0 m* L: \* N9 h9 r
when the
* j3 O) ?6 B4 J/ P3 I! h next packet will be generated. I.e, t+k, where k is the time interval; q8 j' V8 p+ `/ M0 Y
until the next packet
3 P0 k4 V1 T2 l! {. \! D6 r2 a arrives. 3 I+ |* g% _' W1 h/ W" v7 e/ A
4. Collect all required statistics. # `2 g$ H2 P+ H* p
}
3 L, P7 s8 x$ A! A! M( a( j In your simulation, collect the (a) queue length over time, (b)
2 L1 ^! i W+ x0 Q ^; e# o5 uaverage queue length, (c) average
/ q4 E. ?1 C# E6 l end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
# P- x% e" S+ Beffect of the following
; s8 r4 Z3 p2 Z5 ~ factors: (i) increasing source and receiver pairs, (ii) varying N
8 ?. d: X( r+ a D* A) T( evalues, (iii) different packet loss / ]8 ?/ |4 Z8 q3 W6 a
reporting periods, (iv) loss calculation methods, (v) load p, (vi)6 ?7 {0 o7 Q* @8 i/ k8 w9 J
router’s transmission rate; 6 ]5 a4 _0 `( A" O
instead of one packet per‐tic, try k packets, and (vii) z* P. Q( x) c9 H! Y9 z9 |2 ~: @$ k8 [
number of new flows
8 O- C; N5 a3 r& I3 T! Y3 darriving at time t .
7 R1 n* r" E5 f# b3 _* c) U' p
5 t$ b2 K8 e2 n, S: ~2 H # D5 F$ X8 L$ J `% W. U
% {4 U0 K+ X# K Do with sources
* P7 Y! R# `0 F4 G/ e: Eusing a token/leaky bucket to control their transmission rate. 4 I( L1 C) h3 V2 @+ c- ?
Another difference is that each source has an application that
9 i% t) J* O# M2 x+ ngenerates bursty traffic, where % K% k" y; [' E. A* j. ^
multiple packets arrive in consecutive time intervals.
6 C ~& Q& l2 c( M0 J To generate bursty traffic, use the following method: " K1 q/ n+ F U3 [
: t. J' J3 @; `8 Y4 | 5 i D5 J v" e+ _
In the diagram above, an application generates a packet when it is in# [# C0 g# l5 V* v0 [
the ON state. With , f# Z3 }6 P- m$ {
probability k, it will transition to the OFF state where it will remain idle. In7 v9 W' j) V1 _) {
this state, it has
# W6 L) U W- {1 {- x$ w# Q probability z of moving back to the ON state.
% y/ [! Y6 L7 O0 U- T) i The pseudo‐code is as follows:
& ^$ ?5 J6 n1 b5 M1 D! v 1. Start at a random state: ON/OFF.
$ T! B$ l% X' K- D; _+ n" n 2. At every simulation tic, do ' S8 @4 g. b. F: Z
a. Select a random number R in 0<= R <=1. 8 T4 X0 ~0 v+ u" O& R4 Q _
b. If in state=ON
, g* @$ q. x( Y# _. D4 tAND R>=k, set state=OFF.
0 B$ l6 r6 X- m8 J" Y* N c. If in state=OFF AND R>z, set state=ON.
, W9 q D/ Z D9 f. r+ O, l: A9 K1 K d. If state equals ON, generate a packet. 6 i g5 L% p8 c$ f- l
Design an algorithm to control the token/leaky‐bucket rate of each# X6 X6 G( j6 Z" X0 B$ F M
source (or all sources . r2 L) O% W7 I$ v) f. V# P( t; D
simultaneously) such that congestion does not happen. Note, you must
# K+ p. T7 U$ E5 i% Hexperiment with
5 K1 H: `% q9 _7 T( ~ different k6 m. w- k- ?( S7 y; V6 B& B
and z f1 R2 r" D: b. ]1 t
values and determine# Y: w8 U2 I# U
their impact on congestion.
- U; r( w; @1 @7 e9 c8 F8 A3 H9 U Reference
; t6 X8 A! b( }2 n) X S. Floyd, M. Handley, J. Padhye,. p2 x' v8 a, G9 W/ z
and J. Widmer (2000) Equation-based Congestion Control for Unicast 4 g1 t$ G- i( c& n
Applications, ACM SIGCOMM, May,, O: I; M' q9 ^" y/ o& I; w
2000.
# K# b# o; ?! }* W6 u! p; q) P0 e + ?. z2 u+ q6 B, K9 q
: {: ]$ v; m! I8 |) n9 \ x
|