在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下
6 ]4 @ P1 c$ e& C' m0 g. N The risk of congestion collapse on the Internet is becoming a reality' x- A" Z A2 l* ]$ M* H s
given the increasing number
8 s( w6 G( A( q9 m# w of audio/video applications that use UDP as their main transport7 |7 I# v. g% V: E; v
protocol. Unlike TCP, these
: p3 k7 B3 r, O, x' m7 \ traffic do not respond to congestion signal; i.e., a packet loss. As a
9 j: x' p+ Y% X; O- Jresult, audio/video
- I+ h- F: K3 g2 V applications may take an unfair share of the network bandwidth and( D6 Q8 I5 r/ B2 b0 T5 q9 s
also cause persistent ; M# g4 L8 ?4 ]$ M
congestion. To avoid congestion collapse, the IETF has proposed that
* T5 C8 C" ^ ?* _6 N2 maudio/video applications
- Z6 k- H( |/ ?: { use equation based congestion control (see Lecture‐7 and the reference
1 g% \% F& m. G# f) E3 g V' kgiven on the next
; @$ B" J- x! W! L page).
5 |, ^( k9 \+ _* u( y5 f In this assignment, you will simulate n
5 b, q* f! V4 Tsources that uses* K' k T* D' P) H, c
equation based congestion control to ) U- u; @% h6 ?% b+ b- E5 ]7 S
set their transmission rate. From your simulation, you will determine$ q. _. i3 t! E5 _, t
whether equation based 9 E/ r2 b6 Z* Q5 }4 t3 B+ Y
congestion! q( Q" \; i% [7 ~6 y8 r' z* C
control is effective in reducing packet loss, and hence congestion. - u# g2 H, H* i% d: t/ [6 X/ v
' o2 V: c, d6 t6 ^7 Y3 ]
The above network can then be simulated as follows: " b) R0 t# M5 p+ @9 t( [
Initialization - ^+ O7 d4 V8 ^9 U1 b9 P3 @
Set the router’s queue size to N, meaning it can hold up to N packets.
/ `) O$ m" g" z For each sender, set an initial transmission rate, and determine the$ \3 l+ ]* J$ ` z7 s. x- N K
time when the first packet is ) m6 f+ j+ I& e! Z
to be generated.
7 Z, v0 Q8 a, _1 | Body
& P8 B; Q3 f& v d9 c" M/ q FOR t=1 to SIM_TIME DO
[# x6 @, W/ K$ D) X { . T/ i. t5 i" ^' O* y7 Y
1. IF the router’s queue is not empty then dequeue a packet, and. F8 q' Z+ k6 c, D$ j+ {! V
enqueue that packet in 6 V( x0 D9 U+ O0 h6 d3 v$ P' }. i
the corresponding receiver’s queue. 3 O$ [+ X$ _* _! V) b3 d4 K+ C) r
2. IF a sender has a packet to send THEN
) a8 O9 {- R& |7 ~2 h; z7 s& t ‐ Check if the router’s queue is full. If not, enqueue the sender’s9 `+ ~7 `& g, s5 d# c
packet. Otherwise,
d8 K( p; B) S$ O( q- a: E/ X( h$ V9 ? discard the packet. $ o' L/ W) e) g- A
3. Determine whether any packet loss rate messages are generated by; d# \& t$ y1 ?7 e8 k
receivers. If yes, & j( |3 \5 W6 q
then re‐compute the sender’s transmission rate. Determine the new time1 P; ]7 I3 N. Z3 x/ `( a. c% j
when the * t' Z/ |/ K4 _& n" X5 y- s) ]& p) R
next packet will be generated. I.e, t+k, where k is the time interval
" z8 n& f& ]; k/ [* K# Nuntil the next packet 0 ]0 P# y8 W! u* I! ~
arrives.
2 L; |: ]' e$ I& ?& u2 @ 4. Collect all required statistics. * `# V2 d8 j: e. n) H$ F7 {
} ( h# N7 u( `4 \, |: X
In your simulation, collect the (a) queue length over time, (b)
6 D/ I+ K* ~3 u) x( A- a4 Gaverage queue length, (c) average : m- r6 W _1 D/ |
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the0 j h m) d- }6 g9 l
effect of the following $ {# \" b4 l, n
factors: (i) increasing source and receiver pairs, (ii) varying N
* S5 E: ?6 m9 ivalues, (iii) different packet loss
4 q$ ~3 ~" S3 j5 r reporting periods, (iv) loss calculation methods, (v) load p, (vi)6 I8 t1 |% c5 @& v9 y& l7 V( D
router’s transmission rate;
8 z% s, s% s/ Z' v( f' W instead of one packet per‐tic, try k packets, and (vii) z( o2 ?0 Q# S+ T4 _
number of new flows& o4 f+ b* j, w6 [7 D0 D. P9 `- z
arriving at time t .
" F' F( W: J- K# R, }$ t 9 E: j+ x. w, N C
* J0 q- y2 l; `3 s( `6 t
& \. j2 `+ ?5 y% m) ?' ]7 a; Y6 E Do with sources& q, R" V) a2 ?9 d* ]" q
using a token/leaky bucket to control their transmission rate. 3 Z$ D2 @) Q, R
Another difference is that each source has an application that
, V4 I( w( X- D0 J1 D& s3 W# E' |5 H: Jgenerates bursty traffic, where ! V# q9 C Q2 h+ ~$ z
multiple packets arrive in consecutive time intervals.
2 o n4 p/ F. F4 O* h To generate bursty traffic, use the following method: 6 d7 P5 i* i( y& u
! ?$ `7 T- \9 X0 C6 C. V* v# H ) B$ U- d9 U; v, \1 u$ Q' |
In the diagram above, an application generates a packet when it is in
. G* W2 k4 m; [9 w! ?the ON state. With
$ e0 F+ O# w+ [6 q9 h7 u probability k, it will transition to the OFF state where it will remain idle. In
& Z4 D; q6 o4 [4 l6 L/ ?this state, it has 2 A* Z5 q/ b. Y* D1 U* u
probability z of moving back to the ON state. * }6 a9 w/ O8 S/ F9 B3 F. W$ l, z! n$ [
The pseudo‐code is as follows: 9 [4 n( _; K; ^, ^& |
1. Start at a random state: ON/OFF. * F* C9 c) D3 N4 N f
2. At every simulation tic, do
7 ? T- q' C) T' K: N a. Select a random number R in 0<= R <=1. ' Z; q V' n& z$ d; V, A
b. If in state=ON9 X8 D V/ r- b. c [& }
AND R>=k, set state=OFF.
, j2 H1 W) n0 ?! X$ [ c. If in state=OFF AND R>z, set state=ON. * X: f8 X% B7 j" @! n' B' `
d. If state equals ON, generate a packet. # T5 j: a" ?8 Q1 e9 L; m
Design an algorithm to control the token/leaky‐bucket rate of each
5 n% g' ^, q9 U# @: Asource (or all sources
$ r* G( ^( C' ~8 M0 \ simultaneously) such that congestion does not happen. Note, you must
) U5 p5 C+ j3 [1 L, c/ \experiment with
8 G- T2 I8 C t5 }4 \ different k8 D" F. h5 |: q5 L5 Q; H$ K
and z' }* A" `% y+ Y9 Z% L
values and determine
: N& X a$ L' f( J2 A/ K d- \their impact on congestion.
9 v3 E$ j: U5 p1 R8 P) N Reference ; m0 o* `4 W, N" u6 \. b
S. Floyd, M. Handley, J. Padhye,
2 b P# T( Y/ \; B+ h8 hand J. Widmer (2000) Equation-based Congestion Control for Unicast
! [6 F( V6 @. k5 u; d4 M Applications, ACM SIGCOMM, May,* Y! j# U- F5 S/ e) X' L) ~* Y! v7 M
2000.
, I. P1 n r0 o+ Z6 G% U
7 P3 ]! n/ c4 }- Y4 |
" K0 D1 c2 \- ]3 {* @/ ]
|