Packet Scheduling in Linux

Slides:



Advertisements
Similar presentations
DOT – Distributed OpenFlow Testbed
Advertisements

1 CNPA B Nasser S. Abouzakhar Queuing Disciplines Week 8 – Lecture 2 16 th November, 2009.
TELE202 Lecture 8 Congestion control 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »X.25 »Source: chapter 10 ¥This Lecture »Congestion control »Source:
Egress traffic shaping on Linux using Hierarchical Token Bucket (HTB) Brad Baker CS
Basic IP Traffic Management with Access Lists
EECB 473 Data Network Architecture and Electronics Lecture 3 Packet Processing Functions.
1 Packet Scheduling (The rest of the dueling bandwidth story)
Differentiated Services. Service Differentiation in the Internet Different applications have varying bandwidth, delay, and reliability requirements How.
WXES2106 Network Technology Semester /2005 Chapter 10 Access Control Lists CCNA2: Module 11.
UCB Switches Jean Walrand U.C. Berkeley
1 Controlling High Bandwidth Aggregates in the Network.
A serve flow management strategy for IEEE BWA system in TDD mode Hsin-Hsien Liu
Chapter 6 Packet Processing Functions
Lecture 4#-1 Scheduling: Buffer Management. Lecture 4#-2 The setting.
1 IP Forwarding Relates to Lab 3. Covers the principles of end-to-end datagram delivery in IP networks.
Linux Traffic Control Linux Traffic Control Essentials TCNG Overview Study of a Token Bucket Scenario Papadimitriou Panagiotis 17/06/2004.
NetFilter – IPtables Firewall –Series of rules to govern what Kind of access to allow on your system –Packet filtering –Drop or Accept packets NAT –Network.
CIS679: Scheduling, Resource Configuration and Admission Control r Review of Last lecture r Scheduling r Resource configuration r Admission control.
1 IP Forwarding Relates to Lab 3. Covers the principles of end-to-end datagram delivery in IP networks.
Design and Implementation of a Multi-Channel Multi-Interface Network Chandrakanth Chereddi Pradeep Kyasanur Nitin H. Vaidya University of Illinois at Urbana-Champaign.
1 The Internet and Networked Multimedia. 2 Layering  Internet protocols are designed to work in layers, with each layer building on the facilities provided.
ACL & QoS.
Running large scale experimentation on Content-Centric Networking via the Grid’5000 platform Massimo GALLO (Bell Labs, Alcatel - Lucent) Joint work with:
Access-Lists Securing Your Router and Protecting Your Network.
Multimedia Wireless Networks: Technologies, Standards, and QoS Chapter 3. QoS Mechanisms TTM8100 Slides edited by Steinar Andresen.
The Design and Implementation of Firewall, NAT, Traffic Shaper on FreeBSD.
Firewall Policies. Module Objectives By the end of this module participants will be able to: Identify the components used in a firewall policy Create.
Linux Operations and Administration Chapter Eight Network Communications.
1 Fair Queuing Hamed Khanmirza Principles of Network University of Tehran.
Review of IPv4 Routing Veena S, MCA Dept, PESIT Mar 09-10, 2013.
1 A Deficit Round Robin 20MB/s Layer 2 Switch Muraleedhara Navada Francois Labonte.
Providing QoS in IP Networks
1 Lecture 15 Internet resource allocation and QoS Resource Reservation Protocol Integrated Services Differentiated Services.
Address Resolution Protocol Yasir Jan 20 th March 2008 Future Internet.
Chapter 4: server services. The Complete Guide to Linux System Administration2 Objectives Configure network interfaces using command- line and graphical.
Linux Traffic Control and usage of tc/tcng for traffic engineering in Linux October 14, 2008 Laziz Yunusov Advanced Networking Technology Lab. (YU-ANTL)
Tel Hai Academic College Department of Computer Science Prof. Reuven Aviv Markov Models for data flow In Computer Networks Resource: Fayez Gebali, Analysis.
2. Data Link Layer: Medium Access Control. Scheduling.
2007 May1 Chapter 5 Traffic Shaping May2 Traffic shaping Algorithm Two predominant methods for shaping traffic existing: 1. Token bucket Reference.
Instructor Materials Chapter 6: Quality of Service
QoS & Queuing Theory CS352.
Topics discussed in this section:
CS408/533 Computer Networks Text: William Stallings Data and Computer Communications, 6th edition Chapter 1 - Introduction.
Intro to Deterministic Analysis
Congestion Control, Quality of Service, and Internetworking
Next Generation: Internet Protocol, Version 6 (IPv6) RFC 2460
Buffer Management in a Switch
Packet Forwarding.
Chapter 5 Traffic Shaping 2007 July 1.
CONGESTION CONTROL, QUALITY OF SERVICE, & INTERNETWORKING
Computer Network Performance Measures
Variations of Weighted Fair Queueing
Setting Up Firewall using Netfilter and Iptables
Border Gateway Protocol
Intro to Deterministic Analysis
Fair Queueing.
Computer Network Performance Measures
On-time Network On-chip
Computer Science Division
Offloading Linux LAG devices Via Open vSwitch and TC
Variations of Weighted Fair Queueing
Figure Areas in an autonomous system
Networking and Network Protocols (Part2)
IP Forwarding Relates to Lab 3.
Introduction to Packet Scheduling
EECS 122: Introduction to Computer Networks Packet Scheduling and QoS
Hierarchical Scheduling Algorithms
A Simple QoS Packet Scheduler for Network Routers
Introduction to Packet Scheduling
Presentation transcript:

Packet Scheduling in Linux

Traffic Control in Linux The Linux operating system provides a series of traffic control algorithms for Scheduling Shaping Policing Dropping Configuration utility is tc (traffic control), which is part of the iproute2 This presentation is focusing on scheduling

Scheduling Algorithms Default scheduling algorithm is FIFO Others that are available: TBF – Token Bucket Filter PRIO – Static priorities SFQ – Stochastic Fair Queueing Hierarchical scheduling algorithms HTB – Hierarchical Token Bucket CBQ – Class-based queueing HFSC – Hierarchical Fair Service Curves Also: Netem – Add delay to a packet, limit throughput

Linux Scheduling Architecture Non-default scheduling algorithms are provided as part of the iproute2 package

Linux Scheduling A packet scheduler is referred to as a qdisc Qdisc can be attached to a network device to schedule outgoing traffic We consider the loopback device It is a virtual device with IP address 127.0.0.1. Packets sent to loopback are bounced back to the sending host

Linux Scheduling For configuration purposes, each device has a root A qdisc is attached to the root Each qdisk is assigned a handle, e.g., 2:0 or 2: If a qdisc has traffic classes, each class also gets a handle, e.g., 2:1

Linux Scheduling: Example $ sudo tc qdisc add dev lo root handle 2: prio Adds a static priority scheduler to the loopback device By default, there are three priority classes

A qdisc can be attached to (other) qdisc’s $ sudo tc qdisc add dev lo root handle 1: netem rate 50Mbit $ sudo tc qdisc add dev lo parent 1: handle 2: prio Netem is set to a rate limit of 50 Mbps. Scheduling is static priority (with 3 priority levels) Prio is attached to netem any packet transmitted out of prio will go through netem

Handles Handles are unique identifiers for Qdiscs and traffic classes A handle consists of two numbers major and minor separated by “:” major:minor A Qdisc has minor number set to 0, written as major:0 or major: Traffic classes have the major number of the qdisc and a minor number, e.g., 2:1, 2:2, 2:3 This is a useful convention. The strict rule is that classes from the same qdisc must have the same major number.

Traffic classes Some qdiscs, e.g., FIFO are classless, others have traffic classes For some qdiscs, e.g., PRIO, classes are implicitly defined For other classful qdiscs, classes must be specified There are different types of classes, and a class object must match the qdisc object for which it is defined Some qdiscs, e.g., HTB, have a hierarchy of classes

Token Bucket Filter (tbf) $ sudo tc qdisc add dev lo root handle 2: tbf limit 50000 burst 1000 rate 2mbit Token Bucket Filter with 50KB max. backlog size (in buffer), bucket of size 1000 bytes, rate is 2Mbps

Network emulator (netem) Not a scheduler or shaper It is a component that emulates what happens in a real network: adds delay, Imposes rate limit, simulates random packet drops, etc. $ sudo tc qdisc add dev lo root handle 2: netem rate 50Mbit Limits the transmission to a rate of 50 Mbps

Deficit Round Robin (DRR) A Round Robin scheduler which keeps tracks of transmitted bytes One FIFO queue for each flow Operates in “rounds”, where each queue with a backlog is visited once in a round Qi : Quantum of flow Maximum number of bytes from flow i that are sent in one round (Quantum is greater than max. size of flow i packets (Qi > Limax)) DCi : Deficit counter of flow i Credit of flows (in bytes) saved for the next round Credits 50 100 75 50 50 50 75 50 50 50 75 150 75 Credits 50 100 75 Time 50 50 50 50 25 50 50 25 150 75 Credits 50 100 150 50 50 100 50 50 100 150 150 Drawing from:https://web.stanford.edu/class/ee384y/projects/download03/francois_muralee.ppt

Deficit Round Robin (DRR) If queue is empty: Qi=0 Otherwise, Add quantum Qi to flow i in each round: DCi = DCi + Qi Transmit packet with size L from head of queue i and set DCi = DCi - L Continue transmitting (and subtracting DCi) until packet size at head of queue i is larger than DCi Credits 50 100 75 50 50 50 75 50 50 50 75 150 75 Credits 50 100 75 Time 50 50 50 50 25 50 50 25 150 75 Credits 50 100 150 50 50 100 50 50 100 150 150 Drawing from:https://web.stanford.edu/class/ee384y/projects/download03/francois_muralee.ppt 14

Deficit Round Robin (DRR) $ sudo tc qdisc add dev lo root handle 1: drr $ sudo tc class add dev lo parent 1: classid 1:1 drr $ sudo tc class add dev lo parent 1: classid 1:2 drr DRR is a classful scheduler By default, the quantum is set to MTU We need to explicitly define the classes

Hierarchical Token Bucket (htb) Traffic classes fall into multi-level hierarchy Output of htb passes through netem (which controls e maximum transmission rate) Commands are given in lab/assignment handout

Filters Filters associate packets with a class For scheduling, when a packet is added to a qdisc and the qdisc has classes, filters are applied to identify the class Example: Suppose we have three classes 2:1, 2:2, 2:3 $ sudo tc filter add dev lo parent 2: protocol ip u32 match ip dport 10000 0xffff classid 2:1 $ sudo tc filter add dev $INT parent 2: protocol ip u32 match ip dport 10001 0xffff classid 2:2 $ sudo tc filter add dev $INT parent 2: protocol ip u32 match ip dport 10002 0xffff classid 2:3 These filters map packets based on destination ports: 10000  2:1, 10001  2:2, 10002 2:3

Filters (2) Multiple matches: Filters are checked in order, until the first filter matches a packet. If there are multiple filters that match the packet, only the first one is applied Default may be overridden by a `prio` option. No match Each qdisc has its own, default filter. If no user-provided filter matches, the filter of the qdisc is used (Some schedulers, e.g., DRR, drop packets that do not math any filter)

Gotcha: Units Be careful with declaring units in tc. Rate: “kbit”  kilobit/sec “kbps”  kilobyte/sec Size: “kbit”  kilobits “kb”, “k”  kilobytes The same with M (mega), and G (giga).

Gotcha Delete an old qdisc before inserting new ones Sometimes you’ll stumble upon “RTNETLINK answers: File exists”. This means you’re trying to add qdisc to an occupied spot Fixes Remove the old qdisc first, using “tc qdisc del” Use “tc qdisc replace” instead of “tc qdisc add” $ sudo tc qdisc del dev lo root Deletes all qdiscs and classes on the loopback interface