Sie sind auf Seite 1von 9

CS 65 Computer Networks Department of EEE

CS65 - Computer Networks 1 S.Muralidharan

Traditional Elements of Traffic Control Shaping

Shaping Shapers delay packets to meet a desired rate.


Shaping is the mechanism by which packets are delayed before
Scheduling transmission in an output queue to meet a desired output rate.
Classifying This is one of the most common desires of users seeking
bandwidth control solutions.
Policing
The act of delaying a packet as part of a traffic control solution
Dropping makes every shaping mechanism into a non-work-conserving
mechanism, meaning roughly: "Work is required in order to delay
Marking packets."
Shapers attempt to limit or ration traffic to meet but not exceed a
configured rate (frequently measured in packets per second or
bits/bytes per second).
As a side effect, shapers can smooth out bursty traffic.
One of the advantages of shaping bandwidth is the ability to
control latency of packets.
Two of approaches to shaping mechanisms are the interrelated
concepts of tokens and buckets.
26 27

Traffic Shaping The Leaky Bucket Algorithm

Traffic shaping controls the rate at which packets


are sent (not just how many).
The Leaky Bucket Algorithm used to control rate in a
At connection set-up time, the sender and carrier
network. It is implemented as a single-server queue with
negotiate a traffic pattern (shape).
constant service time. If the bucket (buffer) overflows then
Two traffic shaping algorithms are:
packets are discarded.
Leaky Bucket
Token Bucket

28 29

Footer Page 1 of 9.

S.Muralidharan 1
CS 65 Computer Networks Department of EEE
CS65 - Computer Networks 2 S.Muralidharan

The Leaky Bucket Algorithm

(a) A leaky bucket with water. (b) a leaky bucket with packets.

30 31

Leaky Bucket Algorithm- contd…

The leaky bucket enforces a constant output rate


(average rate) regardless of the burstiness of the input.
Does nothing when input is idle.
The host injects one packet per clock tick onto the (a)
network. This results in a uniform flow of packets,
smoothing out bursts and reducing congestion.
When packets are the same size, the one packet per
tick is okay. For variable length packets though, it is (b)
better to allow a fixed number of bytes per tick. E.g.
1024 bytes per tick will allow one 1024-byte packet or
two 512-byte packets or four 256-byte packets on 1
tick. (a) Input to a leaky bucket from host
(b) Output from a leaky bucket.

32 33

Footer Page 2 of 9.

S.Muralidharan 2
CS 65 Computer Networks Department of EEE
CS65 - Computer Networks 3 S.Muralidharan

Token Bucket Algorithm Token Bucket Algorithm …contd

In contrast to the LB, the Token Bucket Algorithm, The token bucket is a control mechanism that
allows the output rate to vary, depending on the size dictates when traffic can be transmitted, based on
of the burst. the presence of tokens in the bucket.
In the TB algorithm, the bucket holds tokens. To The token bucket contains tokens, each of which
transmit a packet, the host must capture and destroy can represent a unit of bytes. The network
one token. administrator specifies how many tokens are
needed to transmit
Tokens are generated by a clock at the rate of one
token every t sec. When tokens are present, a flow is allowed to
transmit. If there are no tokens in the bucket, a flow
Idle hosts can capture and save up tokens (up to the
cannot transmit its packets. Therefore, a flow can
max. size of the bucket) in order to send larger bursts transmit traffic up to its peak burst rate if there are
later. adequate tokens in the bucket and if the burst
threshold is configured appropriately.

34 35

Token Bucket Algorithm …contd Token Bucket Algorithm …contd

The algorithm allows bursts of up to b bytes, but over


The algorithm can be conceptually understood as follows:
the long run the output of conformant packets is limited
A token is added to the bucket every 1 / r seconds. to the constant rate, r. Non-conformant packets can be
The bucket can hold at the most b tokens. If a token treated in various ways:
arrives when the bucket is full, it is discarded.
When a packet (network layer PDU) of n bytes arrives, n They may be dropped.
tokens are removed from the bucket, and the packet is They may be enqueued for subsequent transmission
sent to the network. when sufficient tokens have accumulated in the
bucket.
If fewer than n tokens are available, no tokens are
removed from the bucket, and the packet is considered They may be transmitted, but marked as being non-
conformant, possibly to be dropped subsequently if
to be non-conformant. the network is overloaded.

36 37

Footer Page 3 of 9.

S.Muralidharan 3
CS 65 Computer Networks Department of EEE
CS65 - Computer Networks 4 S.Muralidharan

The Token Bucket Algorithm The Token Bucket Algorithm

5-34

38
(a) Before. (b) After. 39

40 41

Footer Page 4 of 9.

S.Muralidharan 4
CS 65 Computer Networks Department of EEE
CS65 - Computer Networks 5 S.Muralidharan

Leaky Bucket vs Token Bucket

Leaky and Token bucket Algorithm Animation LB discards packets; TB does not. TB discards
tokens.
With TB, a packet can only be transmitted if there are
enough tokens to cover its length in bytes.
LB sends packets at an average rate. TB allows for
large bursts to be sent faster by speeding up the
output.
TB allows saving up tokens (permissions) to send
large bursts. LB does not allow saving.

42 43

Scheduling Classifying

Schedulers arrange and/or rearrange packets for Classifiers sort or separate traffic into queues.
output. Classifying is the mechanism by which packets are
separated for different treatment, possibly different
Scheduling is the mechanism by which packets are output queues.
arranged (or rearranged) between input and output During the process of accepting, routing and
of a particular queue. transmitting a packet, a networking device can
The overwhelmingly most common scheduler is the classify the packet a number of different ways.
FIFO (first-in first-out) scheduler. Classification can include marking the packet,
which usually happens on the boundary of a network
From a larger perspective, any set of traffic control under a single administrative control or classification
mechanisms on an output queue can be regarded can occur on each hop individually.
as a scheduler, because packets are arranged for
output.

44 45

Footer Page 5 of 9.

S.Muralidharan 5
CS 65 Computer Networks Department of EEE
CS65 - Computer Networks 6 S.Muralidharan

Policing Policing

Policers measure and limit traffic in a particular queue. A policer is a yes/no question about the rate at
Policing is simply a mechanism by which traffic can be which traffic is entering a queue.
limited. If the packet is about to enter a queue below a given rate,
take one action (allow the enqueuing).
Policing is most frequently used on the network border to
If the packet is about to enter a queue above a given rate,
ensure that a peer is not consuming more than its
take another action.
allocated bandwidth.
Although the policer uses a token bucket
A policer will accept traffic to a certain rate, and then
mechanism internally, it does not have the capability
perform an action on traffic exceeding this rate. A rather to delay a packet as a shaping mechanism does.
harsh solution is to drop the traffic, although the traffic
could be reclassified instead of being dropped.

46 47

Dropping Marking

Dropping discards an entire packet, flow or Marking is a mechanism by which the packet is
classification. altered.
Dropping a packet is a mechanism by which a Traffic control marking mechanisms install a DSCP
packet is discarded. on the packet itself, which is then used and
respected by other routers inside an administrative
domain

48 49

Footer Page 6 of 9.

S.Muralidharan 6
CS 65 Computer Networks Department of EEE
CS65 - Computer Networks 7 S.Muralidharan

Queues

Queues form the backdrop for all of traffic control A queue becomes much more interesting when
and are the integral concept behind scheduling coupled with other mechanisms which can
In networking, a queue is the place where packets delay packets,
(our units) wait to be transmitted by the hardware rearrange,
(the service). drop and prioritize packets in multiple queues.
In the simplest model, packets are transmitted in a A queue can also use subqueues, which allow for
first-come first-serve basis (FIFO) complexity of behavior in a scheduling operation.
Without any other mechanisms, a queue doesn't
offer any promise for traffic control.
There are only two interesting actions in a queue.
Anything entering a queue is enqueued into the queue.
To remove an item from a queue is to dequeue that item.

50 51

Classless Queuing Disciplines FIFO

FIFO, First-In First-Out It performs no shaping or rearranging of packets.


Priority FIFO It simply transmits packets as soon as it can after
receiving and queuing them.
Weighted Fair Queuing
Must have a size limit (a buffer size) to prevent it
SFQ, Stochastic Fair Queuing from overflowing in case it is unable to dequeue
ESFQ, Extended Stochastic Fair Queuing packets as quickly as it receives them
GRED, Generic Random Early Drop

52 53

Footer Page 7 of 9.

S.Muralidharan 7
CS 65 Computer Networks Department of EEE
CS65 - Computer Networks 8 S.Muralidharan

Priority FIFO

Based on a conventional FIFO


Also provides some prioritization.
It provides different bands (individual FIFOs)
for separating traffic.
The highest priority traffic (interactive flows)
are placed into band 0 and are always
serviced first. Similarly, band 1 is always
emptied of pending packets before band 2 is
dequeued.

54 55

Weighted Fair Queuing SFQ, Stochastic Fair Queuing

The SFQ attempts to fairly distribute opportunity to transmit data to


Packets assigned different classes and sent to the network among an arbitrary number of flows.
different queues It accomplishes this by using a hash function to separate the traffic
But queues are weighted into separate (internally maintained) FIFOs which are dequeued in a
round-robin fashion.
Higher priority means higher weight
Because there is the possibility for unfairness to manifest in the
Process packets in each queue in round-robin
choice of hash function, this function is altered periodically.
Number of packets sent from each queue based on weight
Unfortunately, some clever software (e.g. Kazaa and eMule among
others) obliterate the benefit of this attempt at fair queuing by
opening as many TCP sessions (flows) as can be sustained.
In many networks, with well-behaved users, SFQ can adequately
distribute the network resources to the contending flows, but other
measures may be called for when obnoxious applications have
invaded the network.

56 57

Footer Page 8 of 9.

S.Muralidharan 8
CS 65 Computer Networks Department of EEE
CS65 - Computer Networks 9 S.Muralidharan

ESFQ, Extended Stochastic Fair Queuing

Conceptually, is no different than SFQ although it


allows the user to control more parameters than its
simpler cousin.
Was conceived to overcome the shortcoming of
SFQ identified above. By allowing the user to control
which hashing algorithm is used for distributing
access to network bandwidth, it is possible for the
user to reach a fairer real distribution of bandwidth.

58 59

GRED, Generic Random Early Drop Classful Queuing Disciplines

Theory declares that a RED algorithm is useful on a Classful queuing is very useful if you have different
backbone or core network, but not as useful near the kinds of traffic which should have differing treatment.
end-user. A Classful queue can also divide bandwidth
The idea behind RED is to provide, as soon as is Three classful queues: CBQ Class Based Queuing,
possible, a feedback to responsive flows (like TCP) HTB Hierarchical Token Bucket, PRIO
before the queue overflows in an effort to indicate that
congestion is imminent, instead of waiting until the
congestion has become excessive.
Also, packet drops are distributed more fairly across all
flows.
GRED applies RED to several queues

60 61

Footer Page 9 of 9.

S.Muralidharan 9

Das könnte Ihnen auch gefallen