在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下
* J2 Y: ^( J T- S$ N+ L! _; n The risk of congestion collapse on the Internet is becoming a reality
! n. O" t. c% N5 L. u4 Y; O' U- Ugiven the increasing number
8 k1 K: H8 G; j2 e! l of audio/video applications that use UDP as their main transport5 Q% r2 H8 g. c0 T- k! T
protocol. Unlike TCP, these
I! |) a" ], ]# L( z traffic do not respond to congestion signal; i.e., a packet loss. As a
, q, ^1 u$ r9 s+ k9 Sresult, audio/video 1 Y/ p' ?4 V9 c1 v: y) e
applications may take an unfair share of the network bandwidth and" Z; c. J) n* J( C
also cause persistent
( Q5 n& U4 F3 ~, _0 K/ a congestion. To avoid congestion collapse, the IETF has proposed that' `, w+ ^! I4 C9 U6 ~' _+ W
audio/video applications ! L9 u: p3 P: u/ c- x
use equation based congestion control (see Lecture‐7 and the reference0 ]0 j7 j3 H# X$ d
given on the next 6 [& ?/ c9 ^: V2 r+ f! Q- p
page).
+ |9 S9 z6 T% @4 f) ]' l8 u5 o In this assignment, you will simulate n
2 d/ G6 D( u; X" S3 e Z2 gsources that uses- Y( W6 j) m; S; m t- F
equation based congestion control to
. y. P- |# V0 H2 M set their transmission rate. From your simulation, you will determine
! b' V" P/ O# A4 Q- |whether equation based 3 t- r6 i3 X1 e; H0 h) I9 t3 y
congestion
3 @1 R) n. J* a2 d7 }; q' Scontrol is effective in reducing packet loss, and hence congestion. 0 I2 T! M' i4 ~6 P; z
7 l# D0 x& v; q. i$ ?( b
The above network can then be simulated as follows: & Q* r2 A" F M
Initialization " s. n6 n0 ~% t9 Q' x% C
Set the router’s queue size to N, meaning it can hold up to N packets.
; z' G9 S- D3 x$ W' L+ ^. | For each sender, set an initial transmission rate, and determine the$ Q8 T( T: q8 Z, K, L3 T7 u
time when the first packet is , l j8 u2 g6 t! r1 v, C" @
to be generated. " [) _$ i% x& h# r6 i8 ~- P9 b" V! [
Body
% Y9 ?: X: D# I/ \& T1 T# F FOR t=1 to SIM_TIME DO 7 w+ L# B# C0 l7 q" g0 f& Q
{ 7 P0 L3 R: V+ n$ H' B% G# R4 ?( E
1. IF the router’s queue is not empty then dequeue a packet, and# d/ w5 V, \( x/ z# T
enqueue that packet in . n6 ], b& P; \% L, V
the corresponding receiver’s queue. - f" p/ H3 H0 E
2. IF a sender has a packet to send THEN . _1 g; ^% d- U5 o3 z4 n
‐ Check if the router’s queue is full. If not, enqueue the sender’s) f' g$ h5 d% _: t/ H, X
packet. Otherwise,
1 o1 e7 Y( O$ @( Q C discard the packet.
2 m4 }# S- ]5 W! Q1 m2 V 3. Determine whether any packet loss rate messages are generated by' B" m( P4 |3 R6 W T8 b/ a
receivers. If yes,
- n( n; q; t! W; f- H then re‐compute the sender’s transmission rate. Determine the new time
. v0 U! y0 u6 b# d# V& r2 O4 D+ }8 _when the
- V4 u2 T d( [# h* a next packet will be generated. I.e, t+k, where k is the time interval
, G; w* |* w' Q7 Q8 i& a" w. C; Luntil the next packet
! o. V4 U5 ^$ ]& r# w; G) m, d) U @ arrives.
2 h. ]; F5 V! i1 j0 @; o 4. Collect all required statistics.
4 n1 u: b& K, W" p& g" y% L }
6 {# ]& ^% f9 V2 z2 e' V* S In your simulation, collect the (a) queue length over time, (b)
& ?) Z( E: B) ^; l6 N: ]/ i5 j# ?average queue length, (c) average 1 e- Y l* n: H) {
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
6 d& Z- T+ P, b9 z+ deffect of the following / A7 |8 j% Z+ i/ S
factors: (i) increasing source and receiver pairs, (ii) varying N
# {/ g* E8 H! ?; _5 C- Fvalues, (iii) different packet loss
2 Q% ~# S7 |) i: @3 } reporting periods, (iv) loss calculation methods, (v) load p, (vi)
3 a" C+ I. f0 t X4 i' y" I* drouter’s transmission rate; 7 H! z* n: }/ h( S) ^
instead of one packet per‐tic, try k packets, and (vii) z! K; R4 U& ~5 m* `
number of new flows# E, R: v' @* H3 C
arriving at time t .
. B: T$ F! e& t# ~8 H
0 v( U! f3 j! Q: r3 Q
) M- U" q: L' K- R
0 B1 w$ ~- p1 W9 R2 m* D Do with sources
) d8 q% H( S7 t$ ?using a token/leaky bucket to control their transmission rate.
. s2 k3 a8 M$ T. h# _1 Z Another difference is that each source has an application that
. A* [; r# d* hgenerates bursty traffic, where 0 w+ D ]" ` H/ S+ x; e! Q; K3 f3 N
multiple packets arrive in consecutive time intervals. + I! u0 q; i# r6 A6 w/ R* f9 U% m/ V
To generate bursty traffic, use the following method:
7 A- ^3 `) H1 I0 v# a 0 p9 `0 s/ B/ r
5 L) x* Z+ k6 s1 o In the diagram above, an application generates a packet when it is in9 e9 G' m4 n$ \9 }, B4 c3 J
the ON state. With : _0 Y2 \4 q6 {! g& S; s
probability k, it will transition to the OFF state where it will remain idle. In
- Q% ]+ }6 ^; u [this state, it has
& |+ F4 p$ M( E probability z of moving back to the ON state. T0 m% h O3 z6 [/ A! Q" M
The pseudo‐code is as follows: , [/ u% e; K, }0 w- b+ [
1. Start at a random state: ON/OFF. 3 `, w0 |# {- ^% {5 S
2. At every simulation tic, do
$ i* A+ D( v3 p; c! Y' a7 z8 e2 e a. Select a random number R in 0<= R <=1. 3 U# Z7 P! {" x' X/ K& f
b. If in state=ON
; c, s0 c' J: n- O, k/ BAND R>=k, set state=OFF. ' v z& O! z' Q
c. If in state=OFF AND R>z, set state=ON. & S9 e6 F9 b) m9 J
d. If state equals ON, generate a packet.
+ c3 q% }5 Q6 z4 z Design an algorithm to control the token/leaky‐bucket rate of each
5 i+ b' V4 M8 nsource (or all sources
; z$ T+ K$ Z1 i& Z; H simultaneously) such that congestion does not happen. Note, you must
5 E3 r8 ~* o3 A6 T' F; ~6 ~) Dexperiment with
6 F+ S; M6 t' A9 W: @/ V: Q different k" v' y! e, B& Y4 y( I
and z
+ h- ^6 i" i& T8 c" xvalues and determine
3 D1 A! t2 h# }. Ltheir impact on congestion.
( K2 k9 c& q8 n m1 r Reference ' o- ~4 m- H% b# D
S. Floyd, M. Handley, J. Padhye,/ ^" g! l# I' z8 T+ |: A
and J. Widmer (2000) Equation-based Congestion Control for Unicast
4 I+ K4 \$ d0 l4 z Applications, ACM SIGCOMM, May,3 d- l; u. C9 q% j" p' x. r
2000.
2 r8 z7 |, h+ c2 L; `0 I$ j
$ C9 N& f6 B7 a 1 t: F. t# W8 K" o5 \4 H2 j! t
|