在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下
$ e3 G9 ]1 s J The risk of congestion collapse on the Internet is becoming a reality
6 R3 {( w+ E s. B4 s2 [given the increasing number
: \+ s# x: Z2 Q5 J( S5 t: r# q of audio/video applications that use UDP as their main transport9 c0 Z: L* H/ @& @
protocol. Unlike TCP, these - j; G' l% N7 \! ~, _
traffic do not respond to congestion signal; i.e., a packet loss. As a
! V; T. P1 c+ aresult, audio/video
% K7 P" P4 L5 Q- D8 q8 v applications may take an unfair share of the network bandwidth and3 Y3 `0 [+ x+ z5 S n9 K9 q
also cause persistent
~8 k# | Y6 y u" I8 X congestion. To avoid congestion collapse, the IETF has proposed that
4 s: o2 [- ?# d* ?# R' Kaudio/video applications
0 o6 _4 o! c/ S% |) p! O/ V use equation based congestion control (see Lecture‐7 and the reference
. L" T6 k! J$ W8 E5 j Q" dgiven on the next 6 K( k" s% m' B2 s6 X V
page). * @, ?! F' M: W( h
In this assignment, you will simulate n6 E7 X/ x0 W+ S, r) I- k
sources that uses1 M- `+ T8 |* U1 m
equation based congestion control to 8 y. m3 k' R( P
set their transmission rate. From your simulation, you will determine) l" S6 S! O# ^ g0 s3 I: J' r
whether equation based
; w6 ^2 a$ ?4 q1 b* ~ congestion
+ u/ \- X" {' scontrol is effective in reducing packet loss, and hence congestion. & v. B; |4 u! j9 y
% D% b8 r, R$ t% Q+ ~ The above network can then be simulated as follows: ~9 }. G6 X- v/ h
Initialization 5 v+ W. ~( q8 S2 k+ P$ Z' Z2 Q
Set the router’s queue size to N, meaning it can hold up to N packets.
# N; l9 |. N s1 N% s For each sender, set an initial transmission rate, and determine the. X: n9 j, \- m8 w
time when the first packet is
0 a. b7 K; v4 o1 j3 E `7 v) G to be generated. 5 R* }* u5 ]5 q
Body 8 u4 J; U V+ ?( b/ j# U
FOR t=1 to SIM_TIME DO
5 W# C ~/ R8 B: @+ G6 G# J: ? { ( y( O' m2 Z6 W- P- I7 i+ q9 f. n
1. IF the router’s queue is not empty then dequeue a packet, and. a4 C8 [1 P" x6 R* n, R8 b7 x& z
enqueue that packet in / r7 A9 ?. C; H$ ]$ l
the corresponding receiver’s queue.
9 o1 R' k& P2 T- ?! t8 Y' \ 2. IF a sender has a packet to send THEN * q& a# h# m2 a
‐ Check if the router’s queue is full. If not, enqueue the sender’s
$ C2 h! A5 P* _2 l+ Vpacket. Otherwise, 2 ?, s6 J5 I: p& c) g- @
discard the packet.
# C& S' b/ R! {' P0 E& E 3. Determine whether any packet loss rate messages are generated by2 P* s4 {" x( p; n1 F
receivers. If yes,
# J% c# h, O3 C then re‐compute the sender’s transmission rate. Determine the new time, a B: F& e% a2 S2 {6 ^
when the , i; P! A; Z, p) B
next packet will be generated. I.e, t+k, where k is the time interval- ]9 V( V% G( Y" e
until the next packet : @0 o) W" b# a% Y- u, t- \* |* @
arrives. # ]- d* Q/ E# `) W3 B3 ^' ]# H0 A& [
4. Collect all required statistics. . R& d' f& \; n$ N9 z" Q
}
( j& G7 ]* F2 k5 V( ?, V' \+ q In your simulation, collect the (a) queue length over time, (b)) t( Y% e% {% D7 j. Q: b5 F
average queue length, (c) average
# q( ?3 ~- ?3 p* J) Y end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
2 o) e8 U" N1 teffect of the following
/ K) v; \+ S9 Z' N) V3 K factors: (i) increasing source and receiver pairs, (ii) varying N" _: X; @1 i4 S# \2 R1 ]2 Q
values, (iii) different packet loss
& A8 {# n* }* _5 Z reporting periods, (iv) loss calculation methods, (v) load p, (vi)
7 o$ r6 R( ^! _" b p2 ^( Wrouter’s transmission rate; 2 k( ]. {0 \, d
instead of one packet per‐tic, try k packets, and (vii) z
3 t+ Q. r; J% s+ z( ^number of new flows
# x1 Z% y$ y6 _% [arriving at time t . & d- M" g. u2 q( U
. c* k" F! s# F9 k) o- D S
2 ]8 }& `1 S |/ c9 l # W2 o) X/ T0 I, K1 }4 g1 x
Do with sources- {& Q4 N: e5 ]/ Z6 M- B7 t
using a token/leaky bucket to control their transmission rate. ( \7 X+ s C' ~- A5 H) ?1 e8 @: ^
Another difference is that each source has an application that: @6 C2 R' Y |6 x2 N
generates bursty traffic, where
+ K: z; F. j P5 L, O' x multiple packets arrive in consecutive time intervals.
5 ?8 N" x. D; Z) u8 B To generate bursty traffic, use the following method: , N+ `# Z6 F: n7 y
1 O m) k5 m( C6 r' k: c( D) v' A- U " u/ ^2 G2 m& ^% V: C5 h
In the diagram above, an application generates a packet when it is in
* H% l: h) k- @/ j( g! V0 o; nthe ON state. With ' A5 W/ f" U( h" X3 A7 y
probability k, it will transition to the OFF state where it will remain idle. In
- R. I9 }4 M* G$ T4 rthis state, it has
: n* a% l- C4 q- P7 _ probability z of moving back to the ON state.
3 r7 M) o% i( K9 L0 B# \) k The pseudo‐code is as follows:
) ^8 Y; P8 w9 Q. Q2 Q; \ 1. Start at a random state: ON/OFF.
4 B" F }) U" Z; @; c 2. At every simulation tic, do 9 `5 x9 L1 g' b/ M
a. Select a random number R in 0<= R <=1.
! n6 t" n1 \2 k+ F/ {' H c b. If in state=ON
4 K+ b7 Z8 Z# U( X( [, {AND R>=k, set state=OFF.
) I4 }) i% b9 S- E2 J W/ \ c. If in state=OFF AND R>z, set state=ON. ) t3 K. D8 B6 a, X; [1 o; u! O) N
d. If state equals ON, generate a packet.
! n$ l0 j8 U8 k: Z Design an algorithm to control the token/leaky‐bucket rate of each
; s+ x- p0 X# t( @- N7 \4 z$ tsource (or all sources 2 j' C5 \4 m- P
simultaneously) such that congestion does not happen. Note, you must. y2 G# n0 |6 w% p, F
experiment with 7 w# Q7 E' M2 Y. n+ V% y& _
different k
9 l, }8 z: M: f+ e9 S+ S% sand z% h! }; c' h! w+ z
values and determine2 `4 M# v* ]9 B& ^0 s, ]
their impact on congestion.
$ t I/ t2 U1 r+ k+ L9 z# Z. [ Reference 9 }' u/ W9 A( r0 P" o
S. Floyd, M. Handley, J. Padhye,2 w _+ Y# Z; @7 k! N
and J. Widmer (2000) Equation-based Congestion Control for Unicast
2 J+ Q- L! ]% [. w% b9 g Applications, ACM SIGCOMM, May,
- D$ v2 G$ R. v" A& g! |6 {' i( r' a2000.
/ f) D* P8 U$ N/ Z5 _ , q8 p( c' T; a6 [* U7 w
0 p/ W |; x* n9 }
|