53
Queuing Theory For Dummies Jean‐Yves Le Boudec 1

Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Embed Size (px)

Citation preview

Page 1: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Queuing TheoryFor Dummies

Jean‐YvesLeBoudec1

Page 2: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

All You Need to Know About Queuing Theory

Queuingisessentialtounderstandthebehaviour ofcomplexcomputerandcommunicationsystemsIndepthanalysisofqueuingsystemsishardFortunately,themostimportantresultsareeasy

Wewillstudyonlysimpleconcepts

2

Page 3: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

1. Deterministic QueuingEasybutpowerfulAppliestodeterministicandtransientanalysisExample:playbackbuffersizing

3

Page 4: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Use of Cumulative Functions

4

Page 5: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Solution of Playback Delay Pb

5

A(t) A’(t) D(t)

time

bits

d(0)d(0) - d(0) +

d(t)

A.

Page 6: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

2. Operational Laws

Intuition:SayeverycustomerpaysoneFrperminutepresentPayoffpercustomer=RRateatwhichwereceivemoney=NInaverageλcustomersperminute,N=λR

6

Page 7: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Little Again

ConsiderasimulationwhereyoumeasureRandN.YouusetwocountersresponseTimeCtr andqueueLengthCtr. Atendofsimulation,estimate

R= responseTimeCtr /NbCustN=queueLengthCtr /T

whereNbCust =numberofcustomersservedandT=simulationduration

BothresponseTimeCtr=0 andqueueLengthCtr=0 initiallyQ:Whenanarrivalordepartureeventoccurs,howarebothcountersupdated?A: queueLengthCtr +=(tnew ‐ told). q(told)whereq(told)isthe

numberofcustomersinqueuejustbeforetheevent.responseTimeCtr +=(tnew ‐ told). q(told)

thusresponseTimeCtr == queueLengthCtr andthus

N=RxNbCust/T;nowNbCust/Tisourestimatorof

7

Page 8: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Other Operational Laws

8

Page 9: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

The Interactive User Model

99

Page 10: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Network Laws

10

Page 11: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Bottleneck AnalysisApplythefollowingtwobounds1.2.

11

Example

(1)

(2)

17

Page 12: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Throughput Bounds

12

Page 13: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Bottlenecks

13

A

Page 14: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

DASSA

Intuition:withinonebusyperiod:toeverydeparturewecanassociateonearrivalwithsamenumberofcustomersleftbehind

14

Page 15: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

3. Single Server Queue

15

Page 16: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

16

i.e. which are event averages (vs time averages ?)

Page 17: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

17

Page 18: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

18

Page 19: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

19

Page 20: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

2 4 6 8 10Requests per Second

0.5

1

1.5

2

2.5

Mean Response Time in seconds

Non Linearity of Response Time

20

Page 21: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Impact of Variability

21

0.2 0.4 0.6 0.8Utilization

2

4

6

8

10

12

14

Mean Response Time

Page 22: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Optimal SharingComparethetwointermsof

ResponsetimeCapacity

22

Page 23: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

The Processor Sharing Queue

Models:processors,networklinks

Insensitivity:whatevertheservicerequirements:

Egalitarian

23

Page 24: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

PS versus FIFO

PS FIFO

24

Page 25: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

4. A Case Study

Impactofcapacityincrease?OptimalCapacity?

25

Page 26: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Methodology

26

Page 27: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

4.1. Deterministic Analysis

27

Page 28: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Deterministic Analysis

28

Page 29: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

4.2 Single Queue Analysis

29

Assumenofeedbackloop:

Page 30: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

4.3 Operational AnalysisArefinedmodel,withcirculatingusers

ApplyBottleneckAnalysis(=OperationalAnalysis)

30

Z/(N-1)

-Z

1/c

waiting time

Page 31: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

31

Page 32: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

32

Page 33: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

5. Networks of QueuesStability

QueuingnetworksarefrequentlyusedmodelsThestabilityissuemay,ingeneral,beahardone

Necessaryconditionforstability(NaturalCondition)

serverutilization<1

ateveryqueue

33

Page 34: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Instability Examples

34

Poissonarrivals ;jobsgothrough stations1,2,1,2,1then leaveAjobarrivesastype1,thenbecomes 2,then 3etcExponential,independentservicetimeswith meanmi

Priority schedulingStation1:5>3>1Station2:2>4

Q:What is thenaturalstability condition?A: λ (m1 +m3 + m5 )<1

λ (m2 + m4) < 1

Page 35: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

λ =1m1 =m3 =m4 = 0.1m2 =m5 = 0.6Utilizationfactors

Station1:0.8Station2:0.7

Networkisunstable!

Ifλ (m1 +… +m5 )<1networkisstable;why?

35

Page 36: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Bramson’s Example 1:  A Simple FIFO Network

Poissonarrivals;jobsgothroughstationsA,B,B…,B,AthenleaveExponential,independentservicetimes

Steps2andlast:meanisLOthersteps:meanisS

Q:Whatisthenaturalstabilitycondition?A: λ (L +S )<1

λ ((J‐1)S +L )<1Bramsonshowed:maybeunstablewhereasnaturalstabilityconditionholds

Page 37: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Bramson’s Example 2A FIFO Network with Arbitrarily Small Utilization Factor

m queues2typesofcustomersλ =0.5eachtyperoutingasshown,…=7visitsFIFOExponentialservicetimes,withmeanasshown

37

L LS L LS S S S S S S

Utilization factorat every station≤4λ SNetworkis unstable forS ≤0.01L ≤S8m =floor(‐2(logL )/L)

Page 38: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Take Home Message

Thenatural stability conditionis necessary butmay notbe sufficient

Thereis aclassofnetworkswhere this never happens.ProductFormQueuingNetworks

38

Page 39: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Product Form Networks

Customershaveaclass attributeCustomersvisitstationsaccordingtoMarkovRouting

Externalarrivals,ifany,arePoisson

39

2StationsClass=step,J+3classes

Canyou reduce thenumberofclasses?

Page 40: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Chains

Customerscanswitchclass,butremaininthesamechain

40

ν

Page 41: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Chains may be open or closed

Openchain=withPoissonarrivals.CustomersmusteventuallyleaveClosedchain:noarrival,nodeparture;numberofcustomersisconstant

ClosednetworkhasonlyclosedchainsOpennetworkhasonlyopenchainsMixednetworkmayhaveboth

41

Page 42: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

42

3Stations4classes1openchain1closed chain

ν

Page 43: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Bramson’s Example 2A FIFO Network with Arbitrarily Small Utilization Factor

43

L LS L LS S S S S S S

2StationsMany classes2openchainsNetworkis open

Page 44: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Visit Rates

44

Page 45: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

45

2Stations5classes1chainNetworkis open

Visit ratesθ11 =θ13= θ15 =θ22 =θ24 = λθsc =0otherwise

Page 46: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

46

ν

Page 47: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Constraints on Stations

Stationsmustbelong toarestricted catalog ofstationsSee Section8.4forfulldescriptionWe will give commonly used examplesExample 1:GlobalProcessorSharing

OneserverRateofserveris shared equally among allcustomers presentServicerequirements forcustomers ofclassc aredrawn iid from adistributionwhich depends ontheclass(andthestation)

Example 2:DelayInfinite number ofserversServicerequirements forcustomers ofclassc aredrawn iid from adistributionwhich depends ontheclass(andthestation)Noqueuing,servicetime=servicerequirement =residence time

47

Page 48: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Example 3:FIFOwith BserversB serversFIFOqueueingServicerequirements forcustomers ofclassc aredrawn iid from anexponentialdistribution,independent oftheclass (butmay depend onthestation)

Example ofCategory 2(MSCCCstation):MSCCCwith BserversB serversFIFOqueueing with constraintsAt most onecustomer ofeach classis allowed inserviceServicerequirements forcustomers ofclassc aredrawn iid from anexponentialdistribution,independent oftheclass (butmay depend onthestation)

Examples 1and2areinsensitive (servicetimecan be anything)Examples 3and4arenot(servicetimemustbe exponential,same forall)

48

Page 49: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Saywhichnetworksatisfiesthehypothesesforproductform

49

A

B (FIFO, Exp)C (Prio, Exp)

Page 50: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

The Product Form Theorem

Ifanetworksatisfies the« ProductForm »conditionsgiven earlierThestationary distrib ofnumbers ofcustomers can be written explicitlyItis aproduct ofterms,where each term depends only onthestationEfficientalgorithms exist tocompute performancemetrics foreven very largenetworks

ForPSandDelaystations,servicetimedistributiondoes notmatter other thanthrough its mean (insensitivity)

Thenatural stability conditionholds

50

Page 51: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

51

Page 52: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

52

Page 53: Queuing For Dummies - Performance Evaluationperfeval.epfl.ch/printMe/queuing.pdf · product form 49 A B (FIFO, Exp) C (Prio, Exp) The Product FormTheorem If a network satisfiesthe

Conclusions

Queuingisessentialincommunicationandinformationsystems

M/M/1,M/GI/1,M/G/1/PSandvariantshaveclosedforms

BottleneckanalysisandworstcaseanalysisareusuallyverysimpleandoftengivegoodinsightsQueuingnetworksmaybeverycomplextoanalyzeexceptifproductform–beabletorecognizethem!

53