在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 0 _4 t4 Q, ^! ]3 e
The risk of congestion collapse on the Internet is becoming a reality
- d( o$ R- N- O1 Q6 ?given the increasing number
: E% c! s6 [4 T9 x& s! |) J of audio/video applications that use UDP as their main transport3 X( \& t7 s9 g. R% e4 V% e
protocol. Unlike TCP, these - O) f6 ^- m+ `6 k, A/ Y. i
traffic do not respond to congestion signal; i.e., a packet loss. As a7 v9 T- d8 D* F1 u+ n/ o5 u1 Z& c
result, audio/video / _* g0 \; a& W. L; L2 q
applications may take an unfair share of the network bandwidth and8 P4 \7 C" t& H) E% b4 _
also cause persistent 7 w* F7 z7 C D6 [9 c5 p a1 d/ Y. T3 q
congestion. To avoid congestion collapse, the IETF has proposed that
! F. b4 M A" x7 b; D, F Caudio/video applications
' ^6 P. \/ S) B1 P% o use equation based congestion control (see Lecture‐7 and the reference/ J$ k& i# c# N* }8 C
given on the next 1 u$ z$ X; m" G$ R% h! ^
page). ; s0 P: f1 m( {; t- r5 N$ [
In this assignment, you will simulate n6 f E0 D9 {" l& o s/ u
sources that uses" W* C9 e" M* }: x; j2 O+ f1 r
equation based congestion control to
0 f8 t% l7 l2 P! r; W) t9 _ set their transmission rate. From your simulation, you will determine! x; `$ {9 C9 {5 J. s4 D5 O' A
whether equation based + A& G6 l' Q& H2 [
congestion+ Z7 S6 U8 f# ^# F d8 O
control is effective in reducing packet loss, and hence congestion.
$ X: Q1 Y6 R o, A! z6 I, N
# }5 O+ x7 U( {0 h9 f" P
The above network can then be simulated as follows: ( C( w9 i1 v3 g" r" P! \/ r- [
Initialization , r; W& d+ V" i
Set the router’s queue size to N, meaning it can hold up to N packets. 4 i- _4 ^2 f: E% \
For each sender, set an initial transmission rate, and determine the6 h* ?+ C# _1 j4 D. `: T1 P) l" \2 I
time when the first packet is % y, N4 W' ?4 U7 R3 ?# O
to be generated. , T+ q2 Z3 C" `5 c
Body
* q* n9 A2 m, m+ @( V( b FOR t=1 to SIM_TIME DO 5 X+ K4 C) Z/ C9 \
{
; |' V/ W; r( ?3 k9 C' n3 Z 1. IF the router’s queue is not empty then dequeue a packet, and
U& R: f4 q/ j; i& _enqueue that packet in
+ ~: y9 w n( x: i, o the corresponding receiver’s queue.
6 M7 m3 o' K* p# @ 2. IF a sender has a packet to send THEN
$ z+ E- Q' W+ u ‐ Check if the router’s queue is full. If not, enqueue the sender’s' u8 q5 J+ I# G1 I" U, A
packet. Otherwise, 6 w8 h6 z0 a' U e
discard the packet. - U! A5 ^) x4 d5 ^
3. Determine whether any packet loss rate messages are generated by# h$ h/ i; `! `4 A' X, V# V1 @
receivers. If yes,
1 b; u: ^1 v$ Y$ K; d2 N9 o0 k# s then re‐compute the sender’s transmission rate. Determine the new time
1 f4 D& B! t) u9 ~when the 8 d+ @5 J) ?1 U0 W# Z
next packet will be generated. I.e, t+k, where k is the time interval9 @/ J2 R0 w9 T
until the next packet 4 ?: N% O# M) s! _
arrives. : G; }& Q- [2 H- v9 ]2 l
4. Collect all required statistics. " K8 }9 k+ t+ {% k
}
: I7 i2 @# i2 O9 Y o/ _ In your simulation, collect the (a) queue length over time, (b)! d: G; Q; V6 u/ e; n
average queue length, (c) average : t0 e4 o* M0 x6 I5 `# b7 ]; Z
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
; \/ e3 F1 o# x X+ O0 ^* V: Qeffect of the following
: f) G( e# E9 @( |+ I: u1 n( ^/ ~ factors: (i) increasing source and receiver pairs, (ii) varying N
; z# H# u/ c u5 l( {values, (iii) different packet loss
( p, e% x5 a z0 H' X& v" X T reporting periods, (iv) loss calculation methods, (v) load p, (vi)% E& W! y2 _: G
router’s transmission rate;
3 r" W$ X2 L v instead of one packet per‐tic, try k packets, and (vii) z2 q- @' g; |& T) ^. l5 }
number of new flows
" ~. Q9 b* C* m* Q; tarriving at time t .
/ p9 ]- c! B# {: |3 l4 t6 C3 | L" q , r, l6 g& a9 R4 a, `; ~
2 Q0 Z8 N8 v6 D ! k- p2 E- N% u L6 C8 y
Do with sources9 ]0 C, Y8 J$ E# t, B2 V
using a token/leaky bucket to control their transmission rate. % S6 ^4 r: F. d# p9 F
Another difference is that each source has an application that* U3 U' T2 h, z( d9 E
generates bursty traffic, where
4 ?5 \! S0 p/ q) Q' _% u( h4 g6 J% W multiple packets arrive in consecutive time intervals.
: ?3 s6 m' I% E- ?% }0 m+ s: c To generate bursty traffic, use the following method: ' }' p' v* E6 c; a c7 v
6 U- ^% ?6 ~1 j k3 _( {$ y
3 m1 `9 E4 Y% c6 g [& g* F1 [- E In the diagram above, an application generates a packet when it is in
' g& v0 W! ~4 C9 e% p% |the ON state. With
4 `: X u4 s% `% w' q- y probability k, it will transition to the OFF state where it will remain idle. In t3 j+ I& T2 @1 s; Q; s
this state, it has % d1 f+ h3 X7 v6 J+ ?' G2 i
probability z of moving back to the ON state.
' ~3 Z4 V6 Y6 ? The pseudo‐code is as follows: 0 }5 A5 l+ ]: u* \' G8 C7 S
1. Start at a random state: ON/OFF.
! o3 x0 v+ E7 t! }' Q3 r 2. At every simulation tic, do
$ W# S3 |) Y' A6 Y' p8 b a. Select a random number R in 0<= R <=1.
* V) r3 H- L! D* x2 g! C9 z* B b. If in state=ON
2 `3 w5 |! t* u" x6 z8 n* H+ cAND R>=k, set state=OFF.
! Z& p* U( g. O, ~( s# O c. If in state=OFF AND R>z, set state=ON. W% b. {1 O0 R6 Z# [! h
d. If state equals ON, generate a packet.
. {9 x+ N: R5 ?; o9 _, z3 L Design an algorithm to control the token/leaky‐bucket rate of each, H& T, z$ H4 u3 j C) O% ~) d
source (or all sources % |" P+ J, I1 [1 ]% ^( O' R* J
simultaneously) such that congestion does not happen. Note, you must
+ p! f) b' }2 O O8 S: vexperiment with , W, q3 l' Z* P5 Q# N- y0 I
different k! Y5 q1 |* \) E' ]) Y0 I
and z
" i+ _" T' O7 |" {. ^3 Hvalues and determine, C9 U# k1 ~1 O" T+ O
their impact on congestion. % F$ v8 h1 _; M0 X: G
Reference
) m- R. H; E4 Z4 A( i, d4 @; t7 X S. Floyd, M. Handley, J. Padhye,% @0 C3 i& P/ U" n
and J. Widmer (2000) Equation-based Congestion Control for Unicast
# P5 _( z' A6 {6 E! G5 z, p) ~ Applications, ACM SIGCOMM, May,
) I) } t, b- }1 ~! [. i+ R3 j. Y1 }2000.
; M3 Y& {- r0 p) `0 @8 V) k8 X # M6 @) U" ?2 K! E
7 O) x, ]8 S) T/ A6 O) ^
|