在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 + O/ Z6 u. A( g# c- p S8 a% \( u
The risk of congestion collapse on the Internet is becoming a reality
) V+ ^8 O: J7 mgiven the increasing number * O3 w% A% o5 `4 e7 `7 M' F, Z
of audio/video applications that use UDP as their main transport1 S# h H' A: _( t
protocol. Unlike TCP, these : v% a" l- v7 K. F7 r9 }3 F
traffic do not respond to congestion signal; i.e., a packet loss. As a2 A. I7 b6 f/ Y2 r
result, audio/video
3 @! ~& u7 a9 S# l& d applications may take an unfair share of the network bandwidth and
/ \) }$ e* k$ f' a3 ~4 f5 _also cause persistent
6 X S$ M$ B6 ?% N# }& j congestion. To avoid congestion collapse, the IETF has proposed that% X" A4 o+ l( K0 T9 F/ w* i
audio/video applications 1 ~- `2 k# z6 F2 m1 s! e
use equation based congestion control (see Lecture‐7 and the reference
1 V0 q" u9 O: J% V/ o/ Egiven on the next
% d9 y; M( p. r$ S page). 4 M |/ I, i. [3 g# d' e. U& I( i
In this assignment, you will simulate n
1 N, x" s2 o9 {1 Z$ n+ bsources that uses( K) ?$ e. q: N5 \' C
equation based congestion control to
1 L8 _* e1 B1 F6 f% ^/ [ set their transmission rate. From your simulation, you will determine
) S* D+ C2 r( A) ?0 [" a, h( awhether equation based
9 }1 r$ d0 p4 }$ _, ^$ d# D congestion
) L; w# p' `/ v9 O7 S5 ccontrol is effective in reducing packet loss, and hence congestion. ) Q- K, o' T) v4 k. i" v3 y/ F
/ w- `# [0 N- n3 \' ^ The above network can then be simulated as follows:
1 K- g# A9 |& Y" Q, C) D2 Z5 I5 d Initialization
* e( n, K$ {* _# p Set the router’s queue size to N, meaning it can hold up to N packets.
* q6 D: c% M1 N/ E+ d. p5 b6 A For each sender, set an initial transmission rate, and determine the# Z' N0 a* P( E& O7 A: k
time when the first packet is + z/ [! F Y" _
to be generated. : H' W* N! }$ c+ m
Body 5 J- {+ A9 G1 k9 K) m" u+ l
FOR t=1 to SIM_TIME DO $ V9 X- T% o9 ^- T
{ : x# N* C; Q' M' G; @
1. IF the router’s queue is not empty then dequeue a packet, and: E2 j1 T6 Z) L: ]/ v2 @9 U) `" G( M
enqueue that packet in 0 b$ q* h0 u/ _! ^
the corresponding receiver’s queue. - U$ G6 u4 s- p9 k8 t
2. IF a sender has a packet to send THEN - q6 }: s8 L5 I' z) x7 s- C( [( w
‐ Check if the router’s queue is full. If not, enqueue the sender’s$ P T6 A- V! c: A9 J
packet. Otherwise,
% [3 e9 d5 Y; [/ H6 l" Z. @6 D discard the packet. 9 s* L0 R, Z4 w4 P8 e g
3. Determine whether any packet loss rate messages are generated by5 ?1 l, b: O" _1 b+ H5 ? s
receivers. If yes, : i/ K8 v5 q; p2 b( r
then re‐compute the sender’s transmission rate. Determine the new time
0 y7 ~6 m" K- H9 S3 Ywhen the & N4 H$ S. O9 Z& {0 R
next packet will be generated. I.e, t+k, where k is the time interval' o& }4 t4 r5 O/ W1 p( i
until the next packet , y7 N; I% h6 D' N: M
arrives.
$ Y, S/ J2 X$ F; o' G) ~( C% \2 } 4. Collect all required statistics.
; l; A3 X" T: {; Y: d/ \ } 1 d \2 S4 J6 l4 ^' E
In your simulation, collect the (a) queue length over time, (b)
; p }: @) \0 V/ _5 g6 b# Caverage queue length, (c) average
9 R3 z) y0 h: o! z; T5 E end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the( }9 q2 f! A2 ?% i* U1 C
effect of the following - W! B; I8 D( d5 O3 R' v8 Y9 l( m+ z
factors: (i) increasing source and receiver pairs, (ii) varying N8 s! O6 ^. ^/ c
values, (iii) different packet loss $ L( u. j2 w: l) `& l. Q
reporting periods, (iv) loss calculation methods, (v) load p, (vi)6 b* j P5 `# d# C) X5 j. ]! {5 A
router’s transmission rate; $ z; K& O, l& X% B
instead of one packet per‐tic, try k packets, and (vii) z) s: r$ t' F3 J' \4 D+ B* I
number of new flows
( u( h' O, I4 }/ g+ j- uarriving at time t . " e8 s! D) t% l+ Q; x6 C: ?/ {
" d: J+ o6 ^6 W0 H
5 K! v9 Y9 {! k
{( K$ l; C+ r* a Do with sources. @2 H3 V# m! ^9 F5 [8 u. z: `
using a token/leaky bucket to control their transmission rate.
8 h( j& }5 [3 i5 Q# v/ z Another difference is that each source has an application that: |* K2 w2 r/ }+ b' n Y- \' V; j
generates bursty traffic, where , q0 n0 h" _: y" _* v! o8 T8 D: U* Q
multiple packets arrive in consecutive time intervals.
9 B) y3 k; K2 m( H- g To generate bursty traffic, use the following method:
% @! j i. Z9 K K T: p# x1 S1 z
8 }/ o! j0 X5 N/ K2 V( N In the diagram above, an application generates a packet when it is in2 H& U }& c+ B8 j7 P' Y
the ON state. With " K( [5 B1 f& |& T" a. C) Q$ ^
probability k, it will transition to the OFF state where it will remain idle. In
5 L- k' H, }# q y' L0 E$ Kthis state, it has
# e! f. V- n; @: x3 Z4 k probability z of moving back to the ON state.
( g$ M/ P0 h6 h X! `8 a* X The pseudo‐code is as follows:
; Z; D$ T8 @9 k 1. Start at a random state: ON/OFF. 0 d! Q: l, U6 L! O, ^
2. At every simulation tic, do ( ~6 l6 p0 H6 `% v* ~ |0 O
a. Select a random number R in 0<= R <=1. 3 ~ z6 @4 B6 v0 y& w0 N
b. If in state=ON* z/ n. U+ A$ V& s; ^% W0 I8 \
AND R>=k, set state=OFF.
4 T+ h3 P2 i0 K c. If in state=OFF AND R>z, set state=ON.
5 i! r# l" W7 } i& w; U6 l d. If state equals ON, generate a packet.
7 ?2 V9 i. n5 n' M! Q& X Design an algorithm to control the token/leaky‐bucket rate of each
1 o p- n5 P) C/ e+ a) Nsource (or all sources ' L; O! ^% ]+ p6 W
simultaneously) such that congestion does not happen. Note, you must/ x: u" x- Y/ ?, m t' ?
experiment with
8 Z6 F2 p: z6 t5 }8 F- z different k
: W) X% A9 {+ f% tand z
' T# W* t- K* b+ Yvalues and determine( T) |6 j# c% |( T! h/ f6 i1 s( F1 d; E
their impact on congestion.
, u. I5 j8 |/ ]/ Q6 `4 g/ x0 ? Reference
$ d; m, J2 Y5 [9 S1 m C* J! y2 ~7 G S. Floyd, M. Handley, J. Padhye,# R& S" F! V2 r3 k# p. ?3 i
and J. Widmer (2000) Equation-based Congestion Control for Unicast 2 w9 Q- z# u- ^% p) M: x
Applications, ACM SIGCOMM, May,
8 o. {8 G0 ^8 M8 X* w: {2000. ; C) m( M& K6 j. {6 \
+ M k7 `2 t- c' |) G" X. k5 Z
: N) q% K: L& a9 E
|