在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 " W" l2 Z2 ]4 B& C
The risk of congestion collapse on the Internet is becoming a reality
3 J8 j; ?) l- n9 Ugiven the increasing number ; i5 _ \9 x3 A/ J+ ` u1 y
of audio/video applications that use UDP as their main transport
. @; z7 D- _. x/ {9 ]2 ?protocol. Unlike TCP, these
7 d% O4 ~: \# [ traffic do not respond to congestion signal; i.e., a packet loss. As a" Z2 F. G V3 J% ^) Q
result, audio/video 8 M% [- l; q0 _' w( Q
applications may take an unfair share of the network bandwidth and
- q- h+ R; n: P/ O- M+ |" c5 Oalso cause persistent
6 Q7 X; j1 s# z; L" ]+ r congestion. To avoid congestion collapse, the IETF has proposed that
8 ?6 N" u0 X2 ]2 C+ d! a+ ^6 naudio/video applications 5 N0 Y7 f+ U' i
use equation based congestion control (see Lecture‐7 and the reference: |0 Q) L+ V5 h" o
given on the next 8 `5 w1 S9 Z* U
page).
' o( I0 {9 N' X- _ In this assignment, you will simulate n6 b) A' t8 |, E1 ]4 v' {, B
sources that uses$ Z2 `& ~& K- C4 r% T* f) h$ `; w3 \
equation based congestion control to
% P$ p# J2 _% L5 c# b) E6 L set their transmission rate. From your simulation, you will determine
( c5 F# Q u3 y7 e& ]+ I0 gwhether equation based
% i9 [9 G$ q# [$ e0 D) X7 A congestion
( M0 ]5 _+ E6 y: J- O" qcontrol is effective in reducing packet loss, and hence congestion.
- F8 D* b; i) C3 N c/ q2 L* p
6 d7 a; u, q0 z# I8 U6 S
The above network can then be simulated as follows: 0 x! q6 d4 X! {) p, K- O: I
Initialization
8 Z" _- z5 q' v9 r, y3 c( t3 Q; P Set the router’s queue size to N, meaning it can hold up to N packets. & ^8 g1 m& D/ Z
For each sender, set an initial transmission rate, and determine the6 E$ m# G; ]9 x6 n6 j- b
time when the first packet is + }6 B7 `0 L( \9 j/ {) W
to be generated. 6 _* L- M a6 b: Q. `7 D! k
Body
* [+ R& M$ e, G& ~ FOR t=1 to SIM_TIME DO
- Q8 f, Y2 b1 ` {
% \* e3 c% O; v# I" C. `9 T 1. IF the router’s queue is not empty then dequeue a packet, and
5 g) s/ W- l9 \( n3 U Aenqueue that packet in ) N3 k9 E6 P) O$ }0 E& F2 d
the corresponding receiver’s queue. . Z( G7 G8 s$ x& [- W5 W0 `
2. IF a sender has a packet to send THEN 1 l5 q0 c E( G
‐ Check if the router’s queue is full. If not, enqueue the sender’s
7 Y( b9 Y$ ~: r" c7 fpacket. Otherwise, & S4 u- h3 T3 [$ {! L
discard the packet. " Y6 D, Q+ Y1 {1 ]- D
3. Determine whether any packet loss rate messages are generated by
7 c* R3 K! G* A; s: Y1 Freceivers. If yes,
3 C& C: Y3 K# ?7 x9 T1 x- s then re‐compute the sender’s transmission rate. Determine the new time
$ R3 o- K. r; ?) D' a, Bwhen the 9 A7 m' X. w9 X) [, G
next packet will be generated. I.e, t+k, where k is the time interval5 K9 Z" w) E$ S7 v9 i: ?0 Z% Y* j; c
until the next packet 6 [0 G5 z2 `* c+ z- H1 J, @
arrives.
- r1 ]6 @' a9 d$ ^! { 4. Collect all required statistics.
5 f3 H/ w; p7 }+ [ }
" k% b9 N2 [* G) @- z& R7 R! Y In your simulation, collect the (a) queue length over time, (b)
' W1 _2 M3 C3 p8 gaverage queue length, (c) average . P6 ~( ]; n' n4 x: s
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
: A- N: x/ \0 I& q. Ceffect of the following + y* E' Y( {% L$ D7 o# T- P* q+ |
factors: (i) increasing source and receiver pairs, (ii) varying N
1 K0 w! R1 P c) K9 e% U8 {values, (iii) different packet loss
j% X$ _7 M& } h" w" ` reporting periods, (iv) loss calculation methods, (v) load p, (vi)
8 q- i8 m: {% Z0 o& l! ~router’s transmission rate;
' N" d4 x7 c: ~: S* {9 e instead of one packet per‐tic, try k packets, and (vii) z# ^+ a2 b' A4 x# t0 q" ]' E
number of new flows
( R0 G/ g* [* d6 Carriving at time t . 6 L5 U# Q9 ? v5 P1 P. t2 _6 N
* W* {4 q g! d% Y- a, ?
+ d K, }* [9 N6 @' e7 D5 O
6 z. o$ ?# F6 W9 J* z
Do with sources/ M0 E& H9 j" K6 W$ F0 W* s4 P: a
using a token/leaky bucket to control their transmission rate.
. \) @) i3 t! ^' w( Q" J0 ~5 v Another difference is that each source has an application that3 a8 H$ a8 y+ I( ~
generates bursty traffic, where
8 y& ^ j1 K) G& }3 D+ Z# t4 w" z multiple packets arrive in consecutive time intervals.
' C3 k) y" }$ L To generate bursty traffic, use the following method: % \$ ~: H, z* O
% \' P2 a" z. b; a* s$ |
# R* V) M8 C1 _ In the diagram above, an application generates a packet when it is in' |; w6 s7 s( Q9 V% i
the ON state. With
, W' G* v9 P8 O o, |3 r probability k, it will transition to the OFF state where it will remain idle. In
, I9 j% ^7 j ]) wthis state, it has
$ v- h' P* }: I5 H3 W5 c# I probability z of moving back to the ON state.
6 q" W5 z6 y" Y. f The pseudo‐code is as follows: $ h6 l( d+ `8 D8 ^) ]
1. Start at a random state: ON/OFF.
( J' K) L8 X* }- L9 C; L7 ]* ]$ J7 f 2. At every simulation tic, do ! i- n4 R* E8 i% k8 o' _
a. Select a random number R in 0<= R <=1.
0 _) x4 T. H% i) P8 ~# f b. If in state=ON
) ^8 v# D# L3 Z. NAND R>=k, set state=OFF. : _+ C; Z! L1 h3 K( N) c
c. If in state=OFF AND R>z, set state=ON.
! Q& F# W1 e) A d. If state equals ON, generate a packet.
# w/ [8 D" x$ Q8 R9 e Design an algorithm to control the token/leaky‐bucket rate of each$ T% V4 Q4 T( C# u+ |
source (or all sources
5 S3 R8 J5 ^& s7 \% u simultaneously) such that congestion does not happen. Note, you must
" t U" V+ C7 nexperiment with
3 a7 h0 G x: s different k. D, R4 m4 _0 W1 ]# W5 b! R
and z
$ @( L. f0 T8 U* H7 l1 a$ cvalues and determine
* H B+ V @2 o$ B& otheir impact on congestion. , G& O! R [3 A
Reference
, ?( i; C3 G% R S. Floyd, M. Handley, J. Padhye,
R3 O) _! P+ V7 r2 n1 t. Cand J. Widmer (2000) Equation-based Congestion Control for Unicast # q9 X: ]( Z; Q3 A" s
Applications, ACM SIGCOMM, May, R$ J/ _1 v, X' k6 n, O6 j# M
2000.
9 H$ _4 g5 ` S 0 l3 c& ^6 i* S6 Y
8 A$ f, ^. n8 D
|