在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下 1 s: A8 A% n* r% k
The risk of congestion collapse on the Internet is becoming a reality# K! G- x" |. }
given the increasing number 8 O& ?+ D* D* G2 u; E* ]4 _" N
of audio/video applications that use UDP as their main transport
3 a% a2 S. n) E* C9 p- M- s# p/ Zprotocol. Unlike TCP, these
5 ?: m4 H8 @, t. [ traffic do not respond to congestion signal; i.e., a packet loss. As a3 i1 K1 Y4 U- U5 |
result, audio/video
" H+ I! N; p/ Z! g; V& U applications may take an unfair share of the network bandwidth and2 N" c# {- `+ \" z; v
also cause persistent
o E1 i6 N+ {4 ]5 q* l8 o/ U* A4 h congestion. To avoid congestion collapse, the IETF has proposed that9 M c Y" h0 N; F' W0 h
audio/video applications & G. C4 r( k$ q9 M
use equation based congestion control (see Lecture‐7 and the reference
3 s8 r! Q/ d4 ~) F7 c8 Vgiven on the next " X4 F, B' `4 v6 E, b2 p2 l
page).
; d- M- {: O$ R1 l In this assignment, you will simulate n- G. H P; z% `# K! f+ @, A' ]
sources that uses
# k2 R7 s* u& `7 ^equation based congestion control to 1 F' l/ \- W/ U2 s0 ]
set their transmission rate. From your simulation, you will determine
# ^# E0 W* _6 N4 k$ q) H+ U- bwhether equation based # E" R! r* l/ X( o3 I; j L- r
congestion
! q4 o$ s; ^5 P6 P3 Vcontrol is effective in reducing packet loss, and hence congestion.
0 T, t9 ~! l8 }! M# r3 e# ] h
8 d2 c! |! w4 W% z/ j" x The above network can then be simulated as follows:
6 G {2 D+ Q" E2 [8 ?/ d% G Initialization
8 n1 [8 y) n7 B* ~ Set the router’s queue size to N, meaning it can hold up to N packets. 2 r# m2 |8 m3 W; i' @9 d
For each sender, set an initial transmission rate, and determine the
a; ]$ l' z$ Ctime when the first packet is
/ m4 \; e" Z( ^* z. L to be generated.
/ C% @& a1 o+ I5 [ Body
3 q( k3 Y( I( T3 u FOR t=1 to SIM_TIME DO # S6 k. @0 W8 M! J
{ " X8 U4 _+ a& D6 y6 B. {& z( ]: B
1. IF the router’s queue is not empty then dequeue a packet, and
# C4 Y: E1 j: w( A, }enqueue that packet in 1 {# `! @3 s( x) Y* `
the corresponding receiver’s queue. ; h3 Y* i ~- k- J0 _
2. IF a sender has a packet to send THEN `7 y4 ?6 U0 \$ N9 j0 X
‐ Check if the router’s queue is full. If not, enqueue the sender’s
5 n( \: R( Z7 } |- D4 Q" jpacket. Otherwise,
# Q- Z( f4 j& K" _; A4 u) `% e6 R discard the packet. 2 f) q3 b1 @ U1 H1 N+ P7 ~' g. F
3. Determine whether any packet loss rate messages are generated by
' Q! B- G: K: N" c. [& ]: Rreceivers. If yes, ' r. |$ m2 d1 [+ Q
then re‐compute the sender’s transmission rate. Determine the new time) |. d- S8 A. M* D0 Z$ O! M0 O0 k. S
when the 2 W% z# `0 d4 ^8 }# J
next packet will be generated. I.e, t+k, where k is the time interval
: n+ I) i3 \, guntil the next packet 9 F' H6 Z% p2 X! l& f
arrives.
' N6 F8 E: o& @0 K) O; q 4. Collect all required statistics. & d: t4 A9 H2 u
}
( k( j! l0 t, r: { In your simulation, collect the (a) queue length over time, (b)
6 M4 g" l+ J- v, e: Iaverage queue length, (c) average : a/ y& S* M' l e' Q2 [8 V
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the
4 l: R) j# V/ [; G5 Aeffect of the following " O7 h% ^: \* \! T5 A0 f
factors: (i) increasing source and receiver pairs, (ii) varying N* v# |$ l% x" ]# C( u
values, (iii) different packet loss 5 F& G( w! F, T! N- c# a
reporting periods, (iv) loss calculation methods, (v) load p, (vi)6 @/ b# }9 @) Z* @3 d
router’s transmission rate;
, l1 L4 P* @; C ]: h; {; m7 g instead of one packet per‐tic, try k packets, and (vii) z
" Y8 U2 Z9 ?: f) W5 a; L# ` xnumber of new flows$ D& ] K2 I& c9 S. O
arriving at time t . 5 M L: B; m" t6 I
% b8 n4 W# F. Y
& Q: L! O2 J( V1 ~# \
% W4 C. m& b& v; v3 ?' S2 c Do with sources5 ^! r9 w( O) J+ _% b9 _* e1 U
using a token/leaky bucket to control their transmission rate. + _! Z& D0 F. w. z# R8 ?
Another difference is that each source has an application that
8 K2 ]: L" d% W4 cgenerates bursty traffic, where 2 s+ }4 B2 E% o
multiple packets arrive in consecutive time intervals. 3 h; h h W8 ?$ w N. Z
To generate bursty traffic, use the following method: & e, H, Y I6 R6 H
( s" ~4 P+ V" C9 n- L 4 w2 S. Y" O% S! q% |- U
In the diagram above, an application generates a packet when it is in- Z* E1 Y1 O! f% J2 [, V& e H
the ON state. With v' [" [2 |4 I+ p
probability k, it will transition to the OFF state where it will remain idle. In: ^. ?# R# [, L7 |2 U; h
this state, it has 6 P" J9 r; h# m4 q L) A
probability z of moving back to the ON state. ; M. q- `2 \, w& L; w1 _
The pseudo‐code is as follows:
: H' H8 t1 V' g+ |( G! ^ 1. Start at a random state: ON/OFF.
+ Z" v2 _5 c; E6 m( o1 O 2. At every simulation tic, do
/ g8 B) t9 e" I a. Select a random number R in 0<= R <=1. ! J; q( e3 _ C# Y& F' n$ \
b. If in state=ON- h. e0 K- c* Q# U9 a2 o# W
AND R>=k, set state=OFF.
# @0 H9 H0 P* Z8 s2 S c. If in state=OFF AND R>z, set state=ON.
6 q) R* k. k. U4 E, J; s# P d. If state equals ON, generate a packet.
% {$ a5 ?8 ^* j2 g' j) h Design an algorithm to control the token/leaky‐bucket rate of each2 Z- K' K1 q2 n" O g
source (or all sources : V+ N0 F3 P+ ?
simultaneously) such that congestion does not happen. Note, you must
0 K8 c' z8 k7 q' Qexperiment with
% h6 B$ \! B$ X& i$ _8 M4 Z* m/ ^ different k! j- d3 X6 k* e" Z1 r
and z) J! Z+ B& ]' `! D; Z2 {
values and determine( o( Z. O2 e S9 C7 r- Y, D* W
their impact on congestion.
- |, K u6 P0 |4 I Reference ' o6 K6 x: ]5 V J" u
S. Floyd, M. Handley, J. Padhye,
) Z" a3 J& i/ iand J. Widmer (2000) Equation-based Congestion Control for Unicast 7 |5 K$ R4 U! v0 l0 W' x
Applications, ACM SIGCOMM, May,, T' e% ?7 d; r4 f% B; `+ Q
2000. 7 M1 j* z, {* m" o8 T1 d0 _3 C) r
7 R0 i$ U( ^% n* m& e% X* a
0 `7 M6 [3 U- T+ c
|