lecture 13- congestion control part ii

9
CS 65 Computer Networks Department of EEE S.Muralidharan 1 Traditional Elements of Traffic Control Shaping Scheduling Classifying Policing Dropping Marking 26 Shaping Shapers delay packets to meet a desired rate. Shaping is the mechanism by which packets are delayed before transmission in an output queue to meet a desired output rate. This is one of the most common desires of users seeking bandwidth control solutions. The act of delaying a packet as part of a traffic control solution makes every shaping mechanism into a non-work-conserving mechanism, meaning roughly: "Work is required in order to delay 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. 27 Traffic Shaping Traffic shaping controls the rate at which packets are sent (not just how many). At connection set-up time, the sender and carrier negotiate a traffic pattern (shape). Two traffic shaping algorithms are: Leaky Bucket Token Bucket 28 The Leaky Bucket Algorithm The Leaky Bucket Algorithm used to control rate in a network. It is implemented as a single-server queue with constant service time. If the bucket (buffer) overflows then packets are discarded. 29 CS65 - Computer Networks 1 S.Muralidharan Footer Page 1 of 9.

Upload: yesmurali

Post on 28-Mar-2015

173 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Lecture 13- Congestion Control Part II

CS 65 Computer Networks Department of EEE

S.Muralidharan 1

Traditional Elements of Traffic Control

� Shaping� Scheduling� Classifying� Policing� Dropping� Marking

26

Shaping

� Shapers delay packets to meet a desired rate. � Shaping is the mechanism by which packets are delayed before

transmission in an output queue to meet a desired output rate. � This is one of the most common desires of users seeking

bandwidth control solutions. � The act of delaying a packet as part of a traffic control solution

makes every shaping mechanism into a non-work-conserving mechanism, meaning roughly: "Work is required in order to delay 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. 27

Traffic Shaping� Traffic shaping controls the rate at which packets

are sent (not just how many). � At connection set-up time, the sender and carrier

negotiate a traffic pattern (shape).� Two traffic shaping algorithms are:

�Leaky Bucket�Token Bucket

28

The Leaky Bucket Algorithm

� The Leaky Bucket Algorithm used to control rate in a network. It is implemented as a single-server queue with constant service time. If the bucket (buffer) overflows then packets are discarded.

29

CS65 - Computer Networks 1 S.Muralidharan

Footer Page 1 of 9.

Page 2: Lecture 13- Congestion Control Part II

CS 65 Computer Networks Department of EEE

S.Muralidharan 2

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

The Leaky Bucket Algorithm

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 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 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.

32

(a)

(b)

(a) Input to a leaky bucket from host(b) Output from a leaky bucket.

33

CS65 - Computer Networks 2 S.Muralidharan

Footer Page 2 of 9.

Page 3: Lecture 13- Congestion Control Part II

CS 65 Computer Networks Department of EEE

S.Muralidharan 3

Token Bucket Algorithm

� In contrast to the LB, the Token Bucket Algorithm, allows the output rate to vary, depending on the size of the burst.

� In the TB algorithm, the bucket holds tokens. To transmit a packet, the host must capture and destroy one token.

� Tokens are generated by a clock at the rate of one token every ∆t sec.

� Idle hosts can capture and save up tokens (up to the max. size of the bucket) in order to send larger bursts later.

34

Token Bucket Algorithm …contd

� The token bucket is a control mechanism that dictates when traffic can be transmitted, based on the presence of tokens in the bucket.

� The token bucket contains tokens, each of which can represent a unit of bytes. The network administrator specifies how many tokens are needed to transmit

� When tokens are present, a flow is allowed to transmit. If there are no tokens in the bucket, a flow cannot transmit its packets. Therefore, a flow can transmit traffic up to its peak burst rate if there are adequate tokens in the bucket and if the burst threshold is configured appropriately.

35

Token Bucket Algorithm …contd

The algorithm can be conceptually understood as follows:� A token is added to the bucket every 1 / r seconds. � The bucket can hold at the most b tokens. If a token

arrives when the bucket is full, it is discarded. � When a packet (network layer PDU) of n bytes arrives, n

tokens are removed from the bucket, and the packet is sent to the network.

� If fewer than n tokens are available, no tokens are removed from the bucket, and the packet is considered to be non-conformant.

36

Token Bucket Algorithm …contd

The algorithm allows bursts of up to b bytes, but over the long run the output of conformant packets is limitedto the constant rate, r. Non-conformant packets can betreated in various ways:

� They may be dropped. � They may be enqueued for subsequent transmission

when sufficient tokens have accumulated in the bucket.

� They may be transmitted, but marked as being non-conformant, possibly to be dropped subsequently if the network is overloaded.

37

CS65 - Computer Networks 3 S.Muralidharan

Footer Page 3 of 9.

Page 4: Lecture 13- Congestion Control Part II

CS 65 Computer Networks Department of EEE

S.Muralidharan 4

The Token Bucket Algorithm

38

The Token Bucket Algorithm

(a) Before. (b) After.

5-34

39

40 41

CS65 - Computer Networks 4 S.Muralidharan

Footer Page 4 of 9.

Page 5: Lecture 13- Congestion Control Part II

CS 65 Computer Networks Department of EEE

S.Muralidharan 5

� Leaky and Token bucket Algorithm Animation

42

� 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.

Leaky Bucket vs Token Bucket

43

Scheduling

� Schedulers arrange and/or rearrange packets for output.

� Scheduling is the mechanism by which packets are arranged (or rearranged) between input and output of a particular queue.

� The overwhelmingly most common scheduler is the FIFO (first-in first-out) scheduler.

� From a larger perspective, any set of traffic control mechanisms on an output queue can be regarded as a scheduler, because packets are arranged for output.

44

Classifying

� Classifiers sort or separate traffic into queues. � Classifying is the mechanism by which packets are

separated for different treatment, possibly different output queues.

� During the process of accepting, routing and transmitting a packet, a networking device can classify the packet a number of different ways.

� Classification can include marking the packet, which usually happens on the boundary of a network under a single administrative control or classification can occur on each hop individually.

45

CS65 - Computer Networks 5 S.Muralidharan

Footer Page 5 of 9.

Page 6: Lecture 13- Congestion Control Part II

CS 65 Computer Networks Department of EEE

S.Muralidharan 6

Policing

� Policers measure and limit traffic in a particular queue. � Policing is simply a mechanism by which traffic can be

limited.� Policing is most frequently used on the network border to

ensure that a peer is not consuming more than its allocated bandwidth.

� A policer will accept traffic to a certain rate, and then perform an action on traffic exceeding this rate. A rather harsh solution is to drop the traffic, although the traffic could be reclassified instead of being dropped.

46

Policing

� A policer is a yes/no question about the rate at which traffic is entering a queue. � If the packet is about to enter a queue below a given rate,

take one action (allow the enqueuing). � If the packet is about to enter a queue above a given rate,

take another action. � Although the policer uses a token bucket

mechanism internally, it does not have the capability to delay a packet as a shaping mechanism does.

47

Dropping

� Dropping discards an entire packet, flow or classification.

� Dropping a packet is a mechanism by which a packet is discarded.

48

Marking

� Marking is a mechanism by which the packet is altered.

� Traffic control marking mechanisms install a DSCP on the packet itself, which is then used and respected by other routers inside an administrative domain

49

CS65 - Computer Networks 6 S.Muralidharan

Footer Page 6 of 9.

Page 7: Lecture 13- Congestion Control Part II

CS 65 Computer Networks Department of EEE

S.Muralidharan 7

Queues

� Queues form the backdrop for all of traffic control and are the integral concept behind scheduling

� In networking, a queue is the place where packets (our units) wait to be transmitted by the hardware (the service).

� In the simplest model, packets are transmitted in a first-come first-serve basis (FIFO)

� 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

� A queue becomes much more interesting when coupled with other mechanisms which can � delay packets, � rearrange, � drop and prioritize packets in multiple queues.

� A queue can also use subqueues, which allow for complexity of behavior in a scheduling operation.

51

Classless Queuing Disciplines

� FIFO, First-In First-Out � Priority FIFO � Weighted Fair Queuing� SFQ, Stochastic Fair Queuing � ESFQ, Extended Stochastic Fair Queuing � GRED, Generic Random Early Drop

52

FIFO

� It performs no shaping or rearranging of packets. � It simply transmits packets as soon as it can after

receiving and queuing them.� Must have a size limit (a buffer size) to prevent it

from overflowing in case it is unable to dequeue packets as quickly as it receives them

53

CS65 - Computer Networks 7 S.Muralidharan

Footer Page 7 of 9.

Page 8: Lecture 13- Congestion Control Part II

CS 65 Computer Networks Department of EEE

S.Muralidharan 8

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

� Packets assigned different classes and sent to different queues

� But queues are weighted� Higher priority means higher weight� Process packets in each queue in round-robin� Number of packets sent from each queue based on weight

56

SFQ, Stochastic Fair Queuing � The SFQ attempts to fairly distribute opportunity to transmit data to

the network among an arbitrary number of flows. � It accomplishes this by using a hash function to separate the traffic

into separate (internally maintained) FIFOs which are dequeued in a round-robin fashion.

� Because there is the possibility for unfairness to manifest in the choice of hash function, this function is altered periodically.

� 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.

57

CS65 - Computer Networks 8 S.Muralidharan

Footer Page 8 of 9.

Page 9: Lecture 13- Congestion Control Part II

CS 65 Computer Networks Department of EEE

S.Muralidharan 9

58

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.

59

GRED, Generic Random Early Drop

� Theory declares that a RED algorithm is useful on a backbone or core network, but not as useful near the end-user.

� The idea behind RED is to provide, as soon as is possible, a feedback to responsive flows (like TCP) 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

Classful Queuing Disciplines

� Classful queuing is very useful if you have different kinds of traffic which should have differing treatment.

� A Classful queue can also divide bandwidth � Three classful queues: CBQ Class Based Queuing,

HTB Hierarchical Token Bucket, PRIO

61

CS65 - Computer Networks 9 S.Muralidharan

Footer Page 9 of 9.