在network 中 如何用token bucket to control packet transmission rate. 编程序后做图表分析 能做的高手请与我联系QQ 346719984
内容如下
4 u/ Q+ U& [/ R) d The risk of congestion collapse on the Internet is becoming a reality, D; m8 `: H( G4 R$ c- }
given the increasing number
B7 \3 J' C$ A- p; g& O of audio/video applications that use UDP as their main transport. X) v. E, A( h5 [: p; J
protocol. Unlike TCP, these
5 W9 M$ h; G' V traffic do not respond to congestion signal; i.e., a packet loss. As a i: s/ g2 I( R3 Y' b! E
result, audio/video * P8 A% H4 p# k1 K9 |( ]
applications may take an unfair share of the network bandwidth and- @1 b; ^7 f# U f6 {! [
also cause persistent
5 z% j& m$ W* i% ~; j% f3 w congestion. To avoid congestion collapse, the IETF has proposed that
. m7 f: H$ h) ?7 ?audio/video applications
; `0 U! i3 r$ l5 r- ~& x: @3 S use equation based congestion control (see Lecture‐7 and the reference" l3 ?9 w& s* L2 H }' \- P# S
given on the next
) g& v* V) |# \ page). ! Y' c# V9 @! U# `" D
In this assignment, you will simulate n3 U' Y; ^+ n" a' c( _. M
sources that uses) v' _) M1 b. H* `
equation based congestion control to $ U% @+ N" t! h! y0 k5 ~
set their transmission rate. From your simulation, you will determine0 d$ ~( _1 N3 p
whether equation based
5 F! `3 y& Y) Y3 g congestion
4 }" c! U `* E+ N( mcontrol is effective in reducing packet loss, and hence congestion. 2 ^( v9 |3 w+ b1 K
# y4 U& c8 q) D8 r) c The above network can then be simulated as follows: ( `, A+ I' I; _* T8 a! {
Initialization 3 u* g9 u5 ?3 F6 C2 k/ U# W- l$ x
Set the router’s queue size to N, meaning it can hold up to N packets.
: U7 U+ o+ C; Q4 [5 V ?$ \ For each sender, set an initial transmission rate, and determine the
4 X& a0 v4 K3 C7 mtime when the first packet is
3 k2 g% a8 }9 y8 @* A6 b6 [' A to be generated.
2 |, x; R( ]- x( _, i! L Body ' ]% S5 g4 \( ~$ }' }$ ^
FOR t=1 to SIM_TIME DO 4 _; \! @4 k; x& g2 N
{
, P* ]8 D* x) E 1. IF the router’s queue is not empty then dequeue a packet, and
1 D2 I" n9 |# A9 @) d! A& Zenqueue that packet in % f: E' P; p/ [/ l" e" D# @/ h
the corresponding receiver’s queue.
. i: Y0 x4 G% Z) z9 H' ^- e 2. IF a sender has a packet to send THEN " w i7 K: f# L5 p) P
‐ Check if the router’s queue is full. If not, enqueue the sender’s
& q$ [8 D& p7 T/ e8 M: Fpacket. Otherwise, * M# a- r8 h A3 U0 U
discard the packet.
9 C9 X: }' L5 d1 U+ Y+ g7 ` 3. Determine whether any packet loss rate messages are generated by
% Q1 U Z8 R: E6 mreceivers. If yes,
9 X) s1 {9 s% F1 o9 g- T' b( F1 Q then re‐compute the sender’s transmission rate. Determine the new time
6 Q0 j, {% D, ~4 j, `3 Swhen the
3 U+ r* J% T1 Y, w next packet will be generated. I.e, t+k, where k is the time interval
% P8 C1 _) e+ Puntil the next packet
?) e# K% q$ h) e arrives.
; x) i7 b1 ?& @: \ 4. Collect all required statistics.
0 t' M' e7 u! `" ` }
( @- z' |6 s3 p3 z0 L In your simulation, collect the (a) queue length over time, (b): O4 c9 N0 ~- `
average queue length, (c) average L$ @% G6 {1 O2 t- p4 s
end‐to‐end packet delay, and (d) Jain’s fairness index. Determine the' p( F! M8 S$ I) M0 X
effect of the following 5 D9 {1 |& U8 F2 R6 k7 a. V
factors: (i) increasing source and receiver pairs, (ii) varying N- e6 w5 z: ^- j/ h% c% l
values, (iii) different packet loss
% x1 s v& ^; V) V reporting periods, (iv) loss calculation methods, (v) load p, (vi)
3 g7 T" F/ }0 @. [! q$ @router’s transmission rate;
* O- d+ Q" W$ }2 ] instead of one packet per‐tic, try k packets, and (vii) z: T" @2 a2 S) f( q% [& ^- g2 `
number of new flows
" d8 ^5 W( q& V! S' d7 c1 ~# jarriving at time t . 4 s, e/ ]: T ~7 j% C
- s/ X$ ?* G* Y* H0 w ) Q8 c8 ]5 n% l+ q9 w* B
: y: E1 w S& m3 N$ r3 o Do with sources
) d1 Y3 P5 d! ~9 busing a token/leaky bucket to control their transmission rate. " {6 Y! w2 G; L
Another difference is that each source has an application that
3 M% Y6 M$ B* Vgenerates bursty traffic, where ) O" b+ E8 h/ C5 Z, Y; }7 N( w
multiple packets arrive in consecutive time intervals.
2 f x6 y. l' i8 c) I To generate bursty traffic, use the following method: 2 C+ e/ f5 r9 H+ ?6 W- R. {# O# h2 N
: R* ^7 L4 Z( T/ K) U' ?) F \% t
8 e+ d/ N* e- L7 ]' U; j- z- [% b In the diagram above, an application generates a packet when it is in
W3 R9 `: a, _, ]3 z7 \3 \+ \the ON state. With
$ [& S$ s1 @6 p+ }# @% h probability k, it will transition to the OFF state where it will remain idle. In
@1 l- P! ]) c0 tthis state, it has
}, P; a3 l* T3 A/ a) u probability z of moving back to the ON state. # e7 z( [+ ]: m8 _& p
The pseudo‐code is as follows:
' q' D' d5 o; q7 s( F6 l( O" `) [, ^: o 1. Start at a random state: ON/OFF.
/ z7 m4 d% u- { 2. At every simulation tic, do 0 l, Q) ~+ x1 o& s' L
a. Select a random number R in 0<= R <=1.
* {. a( ~! j0 F; d9 w b. If in state=ON/ Q( e' ]8 p/ k7 `: m) X
AND R>=k, set state=OFF. 6 _- b# R' k( S; y; ^; x
c. If in state=OFF AND R>z, set state=ON.
) z" y% u6 V) q3 _5 g d. If state equals ON, generate a packet.
+ h# ]* m8 m5 q: T6 V Design an algorithm to control the token/leaky‐bucket rate of each
9 @6 G2 q0 p# K0 i7 bsource (or all sources
) f% M) x4 j0 i8 [' X9 Q% v simultaneously) such that congestion does not happen. Note, you must
) k$ \0 n) M- _% }. h! nexperiment with
' ^3 f( C; [! _3 O+ x- G different k
( @5 w) K- h( m6 L$ g/ zand z
5 J3 w7 x2 ~0 `1 g! i: gvalues and determine* g3 @! c, k1 J; P5 d
their impact on congestion. & [5 g7 m# j) u2 {4 o T
Reference
, D9 q% c# E) I9 e- |. ]4 L S. Floyd, M. Handley, J. Padhye,
: S$ E2 p. E( ]# i9 V9 |1 G4 `and J. Widmer (2000) Equation-based Congestion Control for Unicast % Y; ?1 W# e* p: K8 n' l. `
Applications, ACM SIGCOMM, May,
+ w @$ |4 @2 x& o7 F2000. ' R0 c* ?" g9 q3 p" v
" i/ H! f+ H0 W1 H' ~2 G
' H; e5 u+ \8 V* _2 E6 a
|