EECS 122 Introduction to Computer Networks Packet Scheduling

  • Slides: 44
Download presentation
EECS 122: Introduction to Computer Networks Packet Scheduling and Qo. S Computer Science Division

EECS 122: Introduction to Computer Networks Packet Scheduling and Qo. S Computer Science Division Department of Electrical Engineering and Computer Sciences University of California, Berkeley, CA 94720 -1776 EECS 122 - UCB Katz, Stoica F 04

Today’s Lecture: 15 2 17, 18, 19 6 Transport 10, 11 14, 15, 16

Today’s Lecture: 15 2 17, 18, 19 6 Transport 10, 11 14, 15, 16 7, 8, 9 21, 22, 23 25 Application Network (IP) Link Physical Katz, Stoica F 04 2

Packet Scheduling § Decide when and what packet to send on output link -

Packet Scheduling § Decide when and what packet to send on output link - Usually implemented at output interface of a router flow 1 1 2 Classifier flow 2 Scheduler flow n Buffer management Katz, Stoica F 04 3

Goals of Packet Scheduling § § § Provide per flow/aggregate Qo. S guarantees in

Goals of Packet Scheduling § § § Provide per flow/aggregate Qo. S guarantees in terms of delay and bandwidth Provide per flow/aggregate protection Flow/Aggregate identified by a subset of following fields in the packet header - § source/destination IP address (32 bits) source/destination port number (16 bits) protocol type (8 bits) type of service (8 bits) Examples: - All packets from machine A to machine B All packets from Berkeley All packets between Berkeley and MIT All TCP packets from EECS-Berkeley Katz, Stoica F 04 4

Outline Ø § § Qo. S guarantees Link sharing Service curve (short) Katz, Stoica

Outline Ø § § Qo. S guarantees Link sharing Service curve (short) Katz, Stoica F 04 5

Recap: Token Bucket and Arrival Curve § Parameters - r – average rate, i.

Recap: Token Bucket and Arrival Curve § Parameters - r – average rate, i. e. , rate at which tokens fill the bucket - b – bucket depth - R – maximum link capacity or peak rate (optional parameter) § § A bit is transmitted only when there is an available token Arrival curve – maximum number of bits transmitted within an interval of time of size t r bps Arrival curve bits slope r b*R/(R-r) b bits slope R <= R bps time regulator Katz, Stoica F 04 6

How Is the Token Bucket Used? § Can be enforced by - End-hosts (e.

How Is the Token Bucket Used? § Can be enforced by - End-hosts (e. g. , cable modems) - Routers (e. g. , ingress routers in a Diffserv domain) § Can be used to characterize the traffic sent by an end-host Katz, Stoica F 04 7

Source Traffic Characterization § § Arrival curve – maximum amount of bits transmitted during

Source Traffic Characterization § § Arrival curve – maximum amount of bits transmitted during an interval of time Δt Use token bucket to bound the arrival curve bps bits Arrival curve Δt time Katz, Stoica F 04 8

Source Traffic Characterization: Example Arrival curve – maximum amount of bits transmitted during an

Source Traffic Characterization: Example Arrival curve – maximum amount of bits transmitted during an interval of time Δt Use token bucket to bound the arrival curve § § bits (R=2, b=1, r=1) Arrival curve 2 5 4 bps 3 2 2 1 1 0 1 2 3 4 5 time 1 3 4 Katz, Stoica F 04 Δt 9

Qo. S Guarantees: Per-hop Reservation § End-host: specify - the arrival rate characterized by

Qo. S Guarantees: Per-hop Reservation § End-host: specify - the arrival rate characterized by token-bucket with parameters (b, r, R) - the maximum admissible delay D § Router: allocate bandwidth ra and buffer space Ba such that - no packet is dropped - no packet experiences a delay larger than D slope ra bits slope r Arrival curve b*R/(R-r) D Ba Katz, Stoica F 04 10

Packet Scheduling § § Make sure that at any time the flow receives at

Packet Scheduling § § Make sure that at any time the flow receives at least the allocated rate ra The canonical example of such scheduler: Weighted Fair Queueing (WFQ) Katz, Stoica F 04 11

Recap: Fair Queueing § Implements max-min fairness: each flow receives min(ri, f) , where

Recap: Fair Queueing § Implements max-min fairness: each flow receives min(ri, f) , where - ri – flow arrival rate - f – link fair rate (see next slide) § Weighted Fair Queueing (WFQ) – associate a weight with each flow Katz, Stoica F 04 12

Fair Rate Computation: Example 1 § If link congested, compute f such that 8

Fair Rate Computation: Example 1 § If link congested, compute f such that 8 6 2 10 4 4 2 f = 4: min(8, 4) = 4 min(6, 4) = 4 min(2, 4) = 2 Katz, Stoica F 04 13

Fair Rate Computation: Example 2 § § Associate a weight wi with each flow

Fair Rate Computation: Example 2 § § Associate a weight wi with each flow i If link congested, compute f such that (w 1 = 3) 8 (w 2 = 1) 6 (w 3 = 1) 2 10 4 4 2 f = 2: min(8, 2*3) = 6 min(6, 2*1) = 2 min(2, 2*1) = 2 Flow i is guaranteed to be allocated a rate >= wi*C/(Σk wk) If Σk wk <= C, flow i is guaranteed to be allocated a rate >= wi Katz, Stoica F 04 14

Fluid Flow System § § Flows can be served one bit at a time

Fluid Flow System § § Flows can be served one bit at a time WFQ can be implemented using bit-by-bit weighted round robin - During each round from each flow that has data to send, send a number of bits equal to the flow’s weight Katz, Stoica F 04 15

Fluid Flow System: Example 1 Packet Size (bits) Packet inter-arrival time (ms) Rate (Kbps)

Fluid Flow System: Example 1 Packet Size (bits) Packet inter-arrival time (ms) Rate (Kbps) Flow 1 1000 10 100 Flow 2 500 10 50 Flow 1 (w 1 = 1) 100 Kbps Flow 2 (w 2 = 1) Flow 1 (arrival traffic) 1 2 5 time Flow 2 (arrival traffic) Service in fluid flow system 4 3 1 1 0 3 4 3 2 10 2 1 20 6 4 2 30 5 3 40 5 4 50 time 5 60 6 70 80 time (ms) Katz, Stoica F 04 16

Fluid Flow System: Example 2 § link Red flow has packets backlogged between time

Fluid Flow System: Example 2 § link Red flow has packets backlogged between time 0 and 10 - Backlogged flow’s queue not empty § § flows weights Other flows have packets continuously backlogged All packets have the same size 0 2 4 6 8 5 1 10 1 15 Katz, Stoica F 04 17 1

Implementation In Packet System § § Packet (Real) system: packet transmission cannot be preempted.

Implementation In Packet System § § Packet (Real) system: packet transmission cannot be preempted. Why? Solution: serve packets in the order in which they would have finished being transmitted in the fluid flow system Katz, Stoica F 04 18

Packet System: Example 1 Service in fluid flow system § 1 3 2 1

Packet System: Example 1 Service in fluid flow system § 1 3 2 1 4 2 3 5 4 5 6 time (ms) Select the first packet that finishes in the fluid flow system Packet system 1 2 1 3 2 3 4 4 5 5 6 time Katz, Stoica F 04 19

Packet System: Example 2 Service in fluid flow system 0 § 2 4 6

Packet System: Example 2 Service in fluid flow system 0 § 2 4 6 8 10 Select the first packet that finishes in the fluid flow system Packet system 0 2 4 6 8 10 Katz, Stoica F 04 20

Implementation Challenge § § § Need to compute the finish time of a packet

Implementation Challenge § § § Need to compute the finish time of a packet in the fluid flow system… … but the finish time may change as new packets arrive! Need to update the finish times of all packets that are in service in the fluid flow system when a new packet arrives - But this is very expensive; a high speed router may need to handle hundred of thousands of flows! Katz, Stoica F 04 21

Example § Four flows, each with weight 1 Flow 1 time Flow 2 time

Example § Four flows, each with weight 1 Flow 1 time Flow 2 time Flow 3 time Flow 4 time ε Finish times computed at time 0 1 2 3 Finish times re-computed at time ε time 0 1 2 3 4 Katz, Stoica F 04 22

Solution: Virtual Time § Key Observation: while the finish times of packets may change

Solution: Virtual Time § Key Observation: while the finish times of packets may change when a new packet arrives, the order in which packets finish doesn’t! - Only the order is important for scheduling § Solution: instead of the packet finish time maintain the number of rounds needed to send the remaining bits of the packet (virtual finishing time) - Virtual finishing time doesn’t change when the packet arrives § System virtual time – index of the round in the bit-by-bit round robin scheme Katz, Stoica F 04 23

System Virtual Time: V(t) § § Measure service, instead of time V(t) slope –

System Virtual Time: V(t) § § Measure service, instead of time V(t) slope – normalized rate at which every backlogged flow receives service in the fluid flow system - C – link capacity - N(t) – total weight of backlogged flows in fluid flow system at time t V(t) time Service in fluid flow system 1 2 3 3 4 4 5 6 5 time Katz, Stoica F 04 24

System Virtual Time (V(t)): Example 1 § V(t) increases inversely proportionally to the sum

System Virtual Time (V(t)): Example 1 § V(t) increases inversely proportionally to the sum of the weights of the backlogged flows Flow 1 (w 1 = 1) time Flow 2 (w 2 = 1) time 1 2 V(t) 3 1 4 2 3 5 4 5 6 C/2 C Katz, Stoica F 04 25

System Virtual Time: Example w 1 = 4 w 2 = 1 w 3

System Virtual Time: Example w 1 = 4 w 2 = 1 w 3 = 1 w 4 = 1 w 5 = 1 V(t) C/4 C/8 C/4 0 4 8 12 16 Katz, Stoica F 04 26

Fair Queueing Implementation § Define - - virtual finishing time of packet k of

Fair Queueing Implementation § Define - - virtual finishing time of packet k of flow i - arrival time of packet k of flow i - length of packet k of flow i - wi – weight of flow i § The finishing time of packet k+1 of flow i is / wi Katz, Stoica F 04 27

Properties of WFQ § Guarantee that any packet is transmitted within packet_lengt/link_capacity of its

Properties of WFQ § Guarantee that any packet is transmitted within packet_lengt/link_capacity of its transmission time in the fluid flow system - Can be used to provide guaranteed services § Achieve max-min fair allocation - Can be used to protect well-behaved flows against malicious flows Katz, Stoica F 04 28

Outline § Ø § Qo. S guarantees Link sharing Service curve (short) Katz, Stoica

Outline § Ø § Qo. S guarantees Link sharing Service curve (short) Katz, Stoica F 04 29

Hierarchical Link Sharing Link 155 Mbps 100 Mbps Provider 1 50 Mbps Provider 2

Hierarchical Link Sharing Link 155 Mbps 100 Mbps Provider 1 50 Mbps Provider 2 50 Mbps Berkeley 20 Mbps EECS seminar video Stanford. 10 Mbps Math seminar audio Campus § § Resource contention/sharing at different levels Resource management policies should be set at different levels, by different entities - Resource owner Service providers Organizations Applications WEB Katz, Stoica F 04 30

Hierarchical WFQ (H-WFQ) Example § § Red session has packets backlogged at time 5

Hierarchical WFQ (H-WFQ) Example § § Red session has packets backlogged at time 5 Other sessions have packets continuously backlogged 10 5 1 4 1 1 1 First red packet arrives at 5 …and it is served at 7. 5 Service in fluid flow system 0 10 20 Katz, Stoica F 04 31

Packet Approximation of H-WFQ § Fluid Flow H-WFQ Packetized H-WFQ 10 6 WFQ 4

Packet Approximation of H-WFQ § Fluid Flow H-WFQ Packetized H-WFQ 10 6 WFQ 4 WFQ 1 WFQ - Select packet finishing first in HWFQ assuming there are no future arrivals - Problem: • Finish order in system dependent on future arrivals • Virtual time implementation won’t work 10 WFQ 2 WFQ 6 1 3 WFQ 4 WFQ 2 WFQ 3 WFQ Idea 1 § Idea 2 - Use a hierarchy of WFQ to approximate H-WFQ Katz, Stoica F 04 32

Problems with Idea 1 § 10 The order of the 4 th blue packet

Problems with Idea 1 § 10 The order of the 4 th blue packet finish time and of the first green packet finish time changes as a result of a red packet arrival Make decision here 5 1 4 1 1 1 Green packet finish first Blue packet finish first Katz, Stoica F 04 33

Problem with Idea 2 § 10 A packet on the second level can miss

Problem with Idea 2 § 10 A packet on the second level can miss its deadline (finish time) 5 1 4 1 1 1 First level packet schedule Second level packet schedule First red packet arrives at 5 …but it is served at 11 ! Katz, Stoica F 04 34

Solution § § Hierarchical-WFQ with a better implementation of WFQ, called Worst-Case Weighted Fair

Solution § § Hierarchical-WFQ with a better implementation of WFQ, called Worst-Case Weighted Fair Queueing (WF 2 Q) Main idea of WF 2 Q - Consider for scheduling only eligible packets - Eligible packet at time t: a packet that has started being serviced in the fluid flow system at time t Katz, Stoica F 04 35

Example Fluid-Flow System WFQ (smallest finish time first) WF 2 Q (smallest eligible finish

Example Fluid-Flow System WFQ (smallest finish time first) WF 2 Q (smallest eligible finish time first) Katz, Stoica F 04 36

Hierarchical-WF 2 Q Example § In WF 2 Q, all packets meet their deadlines

Hierarchical-WF 2 Q Example § In WF 2 Q, all packets meet their deadlines modulo time to transmit a packet (at the line speed) at each level 10 5 1 4 1 1 1 First level packet schedule Second level packet schedule First red packet arrives at 5 . . and it is served at 7 Katz, Stoica F 04 37

Outline § § Ø Qo. S guarantees Link sharing Service curve (short) Katz, Stoica

Outline § § Ø Qo. S guarantees Link sharing Service curve (short) Katz, Stoica F 04 38

Bandwidth-Delay Coupling § Assume - An arrival curve specified by token bucket (R, r,

Bandwidth-Delay Coupling § Assume - An arrival curve specified by token bucket (R, r, b) - A reservation request (rmin, D), where rmin – minimum bandwidth, D – maximum delay § WFQ can be inefficient: to satisfy delay D, the allocated rate ra may need to be much higher than r ! slope ra bits b*R/(R-r) slope r Arrival curve D Katz, Stoica F 04 39

Example § § End-host: request a worst-case delay D=10 ms for a flow characterized

Example § § End-host: request a worst-case delay D=10 ms for a flow characterized by token bucket (R=1 Mbps, b=10 Kb, r=100 Kbps) Router: allocate ra, where ra = b*R / (D*(R-r) + b) = 0. 52 Mbps § Thus, the router needs to allocate to the flow more than 5 times its average rate r ! Katz, Stoica F 04 40

Solution: Service Curve § Generalize the service allocated to a flow - Assume a

Solution: Service Curve § Generalize the service allocated to a flow - Assume a flow that is idle at time s and it is backlogged during the interval (s, t) - Service curve: the minimum service received by the flow during the interval (s, t) bits Arrival Curve D B S (t) = service curve t WFQ implements a linear service curve Katz, Stoica F 04 41

Linear Service Curves: Example bits Service curves bits FTP Video t t Arrival process

Linear Service Curves: Example bits Service curves bits FTP Video t t Arrival process bits Arrival traffic t t bits Service t Video packets have to wait after ftp packets t t Katz, Stoica F 04 42

Non-Linear Service Curves: Example bits Service curves bits FTP Video t t Arrival process

Non-Linear Service Curves: Example bits Service curves bits FTP Video t t Arrival process bits Arrival traffic t t bits Service t t Video packets transmitted as soon as they arrive t Katz, Stoica F 04 43

What You Need to Know § Basic concepts - § Arrival & service curve

What You Need to Know § Basic concepts - § Arrival & service curve Token-bucket specification System virtual time / finish virtual time WFQ properties Link sharing requirements and challenges Bandwidth-delay coupling problem Mechanisms: - WFQ implementation in the fluid flow & packet system § You don’t need to know - Details of WF 2 Q - How service curve works Katz, Stoica F 04 44