Вы находитесь на странице: 1из 61

Day 7

CoS/QoS
(Class of Service)/(Quality of Service)

Johnson Liu
johnsonl@juniper.net reserved. 2011 Juniper Networks, Inc. All rights
| www.juniper.net

Jan.12 , 2012

CoS Overview

2011 Juniper Networks, Inc. All rights reserved. | www.juniper.net

Class of Service Overview


What is CoS?
Ability to treat packets differently as they transit a network device End-to-end mechanism
Does not pertain to only a single network device

Why CoS?
Convergence of voice and data networks Differentiation between applications Guaranteed bandwidth

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 3

CoS Defined

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 4

CoS for Converged Networks


Identify traffic and its requirements

Divide traffic into classes

Define CoS policies for each class

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 5

CoS is Unidirecrional
CoS configuration is unidirectional
You must explicitly configure settings in both directions

egress

C2
fe-0/0/3

PE2
fe-1/1/1 fe-2/0/1

P1

Traffic flow

ingress

CoS Domain

egress

P2
fe-1/0/2

PE1
fe-1/1/1 fe-0/0/2

C1

Traffic flow

ingress
2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 6

A Historic Perspective
Circuit-switched networks
Designed around service levels needed for telephony
Connection-oriented; one user per connection

Suitable for real-time, loss-sensitive applications


Low (fixed) delay Blocking of new connections during congestion

CoS is not required in the historic environment


The network is purpose-built to support application (telephony) requirements

PSTN Voice Voice

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 7

Network Advances
Packet-switched networks
Developed to optimize efficiency for machine-to-machine communications
Multiple users share a connection Unexpected delays and loss during congestion

CoS is still not applicable


The network is purpose-built to support application requirements Applications do not require CoS (Expand bandwidth to solve congestion issue when needed)
Data

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 8

Network Convergence Drives CoS


Convergence drives the need for CoS
Multiple applications supported over a common network infrastructure
Traffic from specific applications must be recognized and treated accordingly Special handling is necessary to ensure that unique applications perform as expected in the face of congestion or queuing delays User bandwidth usage must be controlled

IP is the convergence technology of choice

Voice Video

Data
2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 9

Definition of CoS Parameters


CoS parameters
Bandwidth: End-to-end information carrying capacity Delay: End-to-end delay for information delivery Jitter(Delay variation): Variation in end-to-end delays caused by packet queuing Loss: Percentage of packets not delivered, usually related to congestion

Network CoS parameters affect a users perception of performance

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 10

Three Models for Quality of Service


Best-Effort: No QoS is applied to packets. IntServ: Applications signal to the network that they require special QoS. DiffServ: The network recognizes classes that require special QoS.

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 11

Best-Effort Model
Internet initially based on a best-effort packet delivery service The default mode for all traffic No differentiation between types of traffic Like using standard mail
It will get there when it gets there.

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 12

IntServ Model
Some applications have special bandwidth or delay requirements or both IntServ introduced to guarantee a predictable behavior of the network for these applications Guaranteed delivery: no other traffic can use reserved bandwidth Like having your own private courier plane
2011 Juniper Networks, Inc. All rights reserved.

It will be there by 10:30 a.m.

www.juniper.net | 13

DiffServ Model
Network traffic identified by class Network QoS policy enforces differentiated treatment of traffic classes You choose level of service for each traffic class Like using a package delivery service

Do you want overnight delivery? Do you want two-day air delivery? Do you want three- to seven-day ground delivery?

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 14

A Brief History of IP CoSIntServ


Integrated Services(InterServ):
IETFs first attempt at extending IP for other than besteffort services RSVP signaling used to describe specific CoS requirements to the network(Host-to-Host)
Routers reserve resources across the network Resembled a circuit-switched call setup

Never deployed
Scalability issues

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 15

A Brief History of IP CoS Type-of-Service Field


Type-of-Service(TOS) byte in the IP header
Defined in RFC 791 IP Precedence(0~7) field to prioritize discards
Industry supported precedence bits to minimize loss of networkcontrol packets

MSB

3 D

4 T

5 R

LSB

Bits

IP Precedence

Reserved

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 16

DiffServ architecture
DiffServ architecture:
Defined in RFCs 2474 and 2475 Redefined the IPv4 ToS field to support a 6-bit DiffServ Code Point (DSCP) DiffServ has no signaling component
Operates on hop-by-hop basis

MSB

LSB

Bits

------------------------------------ DSCP ---------------- ------- ECN ------------------------- 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 17

DiffServ Terminology (1 of 2)
Key DiffServ terms:
IP Precedence
3-bit value (0~7) Original IPv4 ToS byte

DSCP
6-bit value (0~63) This is the CoS value for a packet

Behavior Aggregate (BA)


Classification based on DSCP Packets with a common DSCP belong to the same BA

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 18

DSCP Encoding

DiffServ field: The IP version 4 header ToS octet or the IPv6 traffic class octet, when interpreted in conformance with the definition given in RFC 2474 DSCP: The first six bits of the DiffServ field, used to select a PHB (forwarding and queuing method)
2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 19

DiffServ Terminology (2 of 2)
Key DiffServ terms (contd.):
Per-Hop Behavior (PHB)
Forwarding treatment associated with a given BA Packets with the same DSCP value have the same PHB

PHB group
A set of one or more PHBs with related forwarding behavior Example: assured forwarding (AF) is a PHB group, consisting of multiple PHBs : AF1, AF2, AF3, and AF4

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 20

Per-Hop Behavior
Per Hop Behavior (PHB)
description of the externally observable forwarding behavior of a DS node applied to a the set of packets with the same DSCP PHB may be defined in terms of
DS nodes resources priority relative to other PHBs observable traffic characteristics (delay, loss, )

PHBs are defined as black box


does NOT mandate particular implementation mechanisms !

Different boxes implement PHBs in different ways which are optimised for each platform
2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 21

Per-Hop Behaviors

DSCP selects PHB throughout the network.


Default (FIFO, Tail drop) EF (Expedited Forwarding) AF (Assured Forwarding) CS (Class-Selector) mapping to IPP(IP Precedence)
www.juniper.net | 22

2011 Juniper Networks, Inc. All rights reserved.

Per-Hop Behaviors (Cont.)

Each AF class uses three DSCP values. Each AF class is independently forwarded with its guaranteed bandwidth.
2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 23

Standardized DiffServ PHBs (1 of 2)


Expedited Forwarding(EF)
Designed to provide for low loss, low delay, and low jitter services
Example: Voice Recommended code point: 101110(usually mapped to IPP(5))

Assured Forwarding(AF)
Primarily concerned with controlling packet loss
Four classes: AF1, AF2, AF3, and AF4 Each class supports three drop probabilities; for example, AF11 (low), AF12 (medium), and AF13 (high)
AF 11/12/13 Low Medium High
2011 Juniper Networks, Inc. All rights reserved.

AF 21/22/23 010010 010100 010110

AF 31/32/33 011010 011100 011110

AF 41/42/43 100010 100100 100110


www.juniper.net | 24

001010 001100 001110

Standardized DiffServ PHBs (2 of 2)


Class Selector(CS)
Provide IP precedence compatibility Typically used for network control traffic

Best effort is not specifically defined


Best effort is the default PHB

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 25

EF PHB Definition
RFC 2598 Expedited Forwarding PHB, June 99 EF PHB can be used to build a low loss, low latency, low jitter, assured bandwidth, end-toend service targets VoIP, Virtual Leased Lines
Assured traffic sees no (or very small) queues/delay Constraint: at every transit node, the aggregates max arrival rate is less than the aggregate min departure rate

An example of how EF can be implemented is a Priority Queue (with rate limit). Recommended DSCP=101110 (46)

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 26

AF PHB Group Definition


RFC2597, Assured Forwarding PHB Group, June 99 Assured Forwarding (AF) PHB Group is meant to offer different levels of forwarding assurances for IP packets received from a customer DS domain Olympic Service (Gold, Silver, Bronze)
gold (C1) >= silver (C2) >= bronze (C3)

No quantifiable timing requirements!


delay or delay variation

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 27

Recommended DSCPs
IANA maintains a list of recommended DSCPs
Based on RFC recommendations for defined PHBs
Name CS0 CS1 CS2 CS3 CS4 CS5 CS6 CS7 DSCP 000000 (0) 001000 (8) 010000 (16) 011000 (24) 100000 (32) 101000 (40) 110000 (48) 111000 (56) Name AF11 DSCP 001010 (10)

AF12
AF13 AF21

001100 (12)
001110 (14) 010010 (18)

AF22
AF23 AF31 AF32 AF33 AF41 AF42 AF43 EF

010100 (20)
010110 (22) 011010 (26) 011100 (28) 011110 (30) 100010 (34) 100100 (36) 100110 (38) 101110 (46)
www.juniper.net | 28

2011 Juniper Networks, Inc. All rights reserved.

Classification and Marking at the Data-Link LayerEthernet 802.1Q Class of Service

IEEE specification 802.1P user priority field Supports up to 8 classes of service

Focuses on support for QoS over LANs and 802.1Q ports

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 29

Classification and Marking at the Data-Link LayerFrame Relay/ATM QoS

Frame Relay DTE devices can set the DE bit of a frame so that if the network becomes congested, Frame Relay devices will discard frames with the DE bit set before discarding those that do not have the DE bit set. Preserved throughout the Frame Relay network.

The CLP bit indicates that the cell should be discarded if it encounters congestion as it moves through the network. Preserved throughout the ATM network.
2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 30

Classification and Marking at the Data-Link LayerMPLS Experimental Bits

MPLS uses a 32-bit label field (shim header) which is inserted between Layer 2 and Layer 3 headers (frame mode). Supports up to 8 classes of service. The IP precedence or DSCP field is not directly visible to MPLS label switch routers. In most casen, routers will copy the three most significant bits of the DSCP or the IP precedence of the IP packet to the EXP field. Preserved throughout the MPLS network.
2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 31

Comparison
Best-Effort Service Connectivity No isolation No guarantees End-to-end No set-up Diffserv Per aggregation isolation Per aggregation guarantee Domain Long term setup Intserv Per flow isolation Per flow guarantee

Service Scope Complexity

End-to-end Per flow setup

Scalability

Highly scalable Scalable (edge routers (nodes maintain maintains per only routing state) aggregate state; core routers per class state)

Not scalable (each router maintains per flow state)

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 32

CoS Processing Stages

2011 Juniper Networks, Inc. All rights reserved. | www.juniper.net

What is Class of Service ?


CoS provides mechanisms for categorizing traffic and meeting performance requirements within a network
Voice
Packet A

Video
Packet A Packet B Packet C Packet B

Data
Packet C

Note: CoS does not make a network faster or reduce congestion!


2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 34

CoS Components
CoS components:
Traffic classification Policing Queuing Scheduling Rewrite rules

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 35

Overview of CoS Processing


Ingress

BA Classifier

Policing (Ingress)

Multifield Classifier

Forwarding Policy

Forwarding Class Loss Priority

Fabric

Egress Rewrit e Marker


Scheduler Shaper RED

Multifield Classifier

Policing (Egress)

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 36

Meeting Performance Requirements


CoS meets a networks performance requirements by:
Prioritizing latency-sensitive traffic such as VoIP Controlling congestion to ensure service level agreement(SLA) maintenance Allocating bandwidth for different classes of traffic
VoIP Data VoIP Data

Voice

Voice

Data

Data

Devices should treat traffic consistently throughout the entire network

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 37

Forwarding Classes
Forwarding classes:
Identify traffic that should receive common treatment Used to assign traffic to output queues
Forwarding Class
Voice Packet A Queue 2

Output Queue

Video Packet A Packet B Packet C Packet B Queue 1

Data Packet C Queue 0

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 38

Loss Priority
Loss priority:
Identifies the priority a system should give to dropping a packet Used to select the drop profile used in the RED(Random Early Detection) process
If congestion exists Voice VoIP Data Drop first Data

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 39

JUNOS CoS Defaults


4 Queues Assigned to 4 Forwarding classes(up to 8 Queues/16 Forwarding classes)
Queue Forwarding Class Priority Transmit Rate Drop Profile

0 1
2 3

Best-effort (BE) Expedited-Forwarding (EF)


Assured-Forwarding (AF) Network-Control (NC)

Low
Low

95%
5%

Tail drop

Tail drop

In a default configuration, input BA classification is performed by the ipprec-compatibility table

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 40

Typical CoS Processing Stages


Input Processing
C l a s s i f y
Class 0
Class 1 Class 2 Class 3 Class n

Ingress

Policing or Rate Limit

To Fabric

Output Processing
Queue 0 (Class 0)

From Fabric

Queue 1 (Class 1) Queue 2 (Class 2)


Queue 3 (Class 3)

Congestion Control (WRED)

Header Rewrite Scheduling and Prioritization

Egress

The order of stages can vary slightly across Junos devices.


www.juniper.net | 41

2011 Juniper Networks, Inc. All rights reserved.

Traffic Classification
Classifiers map traffic to a forwarding class at ingress
Can match on existing CoS values
BA classification

Can match on protocol, port, addresses, and so forth


Multifield classification

Support for IP precedence, DSCP (IPv4 and IPv6), MPLS Basic Service EXP, and IEEE 802.1p (BE)
Packet C Packet B Packet A

Classifier

Premium Service (EF) Control Traffic (NC)


www.juniper.net | 42

NC: Network control class


2011 Juniper Networks, Inc. All rights reserved.

Policing
Policing limits traffic volume and burstiness
Enforces and protects CoS SLAs Excess traffic can be marked or discarded Functions at ingress, egress, or both

Ingress Interface

Interface Policer

Policer within MF Classifier

Interface Policer

Egress Interface

MF: Multifield
2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 43

Policing vs Shaping

These mechanisms must classify packets before policing or shaping the traffic rate. Shaping queues excess packets to stay within the desired traffic rate. Policing typically drops or marks excess traffic to stay within a traffic rate limit.
2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 44

Policing vs. Shaping

Out-of-profile packets are dropped Dropping causes TCP retransmits Less buffer usage (shaping requires an additional shaping queuing system)
2011 Juniper Networks, Inc. All rights reserved.

Out-of-profile packets are queued until a buffer gets full Buffering minimizes TCP retransmits Shaping supports interaction with Frame Relay congestion indication
www.juniper.net | 45

CoS and Forwarding Policy


Policy can select the forwarding next hop for traffic associated with a particular forwarding class
CoS-Based Forwarding (CBF)
R3

EF packet BE packet

EF packet R1 R2 R4

CBF in place at R2 for the BE forwarding class

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 46

Schedulers
Schedulers define the prioritization properties of forwarding classes (queues):
Transmission rate
Guaranteed and maximum rates

Queue priority
Support for five priority levels

Delay buffer
Storage space for traffic bursts

Congestion management and avoidance


Support for RED for equal, random dropping of traffic Support for WRED for weighted, preferred dropping of traffic

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 47

First In First Out(FIFO)

First packet in is first packet out Simplest of all One queue All individual queues are FIFO

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 48

Priority Queuing(PQ)
Uses multiple queues Allows prioritization Always empties first queue before going to the next queue:
Empty Queue 1 If Queue 1 empty, then dispatch one packet from Queue 2 If both Queue 1 and Queue 2 empty, then dispatch one packet from Queue 3

Queues 2 and 3 may starve

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 49

Round Robin
Uses multiple queues No prioritization Dispatches one packet from each queue in each round
One packet from Queue 1
One packet from Queue 2 One packet from Queue 3 Then repeat

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 50

Weighted Round Robin(WRR)


Allows prioritization Assign a weight to each queue Dispatches packets from each queue proportionally to an assigned weight:
Dispatch up to 4 from Queue 1 Dispatch up to 2 from Queue 2 Dispatch 1 from Queue 3 Go back to Queue 1

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 51

RED Modes
RED has three modes:
No drop: When the average queue size is between 0 and the minimum threshold Random drop: When the average queue size is between the minimum and the maximum threshold Full drop (tail drop): When the average queue size is at maximum threshold or above

Random drop should prevent congestion (prevent tail drops)

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 52

Weighted RED
Without RED
Packet Drop Probability Queue Length

Queue Max

With RED

Packet Drop Probability

Slope is adjustable (Random drop)


Queue Length Queue Max

Packet Drop Probability

With WRED

Premium Service Standard Service

Queue Length

Std. Min.

Prem. Min.

Queue Max

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 53

Weighted Random Early Detection(WRED)


Standard Premium Upon congestion, packets from lower precedence are selectively discarded first Minimize the congestion impact on higher precedence services

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 54

TCP Traffic Before RED

TCP synchronization prevents average link utilization close to the link bandwidth. Tail drops cause TCP sessions to go into slow-start.
2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 55

TCP Traffic After RED

2011 Juniper Networks, Inc. All rights reserved.

Average link utilization is much closer to link bandwidth. Random drops cause TCP sessions to reduce window sizes.

www.juniper.net | 56

Scheduling Overview
Components of scheduling:
Priority Transmission rate Buffer size RED configuration
Defines the order in which packets transmit Defines the storage and dropping of packets
Queue 0
Dat a

Queue 1 Queue 2

Scheduler Map

Dat a

Queue 3

Dat a Dat a
www.juniper.net | 57

2011 Juniper Networks, Inc. All rights reserved.

Queue Priority
Queues receive service according to their assigned priority; common priorities include:
Strict-High(might starve low priority queue) High Medium high Medium low Data Low
Queue 4 (SH) 3 Queue 3 (H) 6 4 Queue 2 (MH) 2 Queue 1 (ML) 7 Queue 0 (L) 5 1

Serviced first

Scheduler Map

5 1 7 2 6 4 3

Serviced last
www.juniper.net | 58

2011 Juniper Networks, Inc. All rights reserved.

Rewrite Markers
The packet header rewrite sets CoS values for outbound traffic
Can be used by BA classification in downstream nodes Support for IP precedence, DSCP (IPv4 and IPv6), MPLS EXP, and IEEE 802.1p

The inbound classifier assigns a packet to forwarding class


DSCP = 000000 Packet

Rewrite sets the packets DSCP coding based on the forwarding class
DSCP = 0001001 Packet

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 59

Review of CoS Processing


Ingress

BA Classifier

Policing (Ingress)

Multifield Classifier

Forwardin g Policy

Forwarding Class Loss Priority

Fabric

Egress

Rewrit e Marker

Scheduler

Shaper

RED

Multifiel d Classifie r

Policing (Egress )

2011 Juniper Networks, Inc. All rights reserved.

www.juniper.net | 60

Reference: JUNOS CoS Configurtion Guide (JUNOS 11.4)

Вам также может понравиться