71
Introduction to Performance Engineering and Modeling Dr. Michele Mazzucco Software Engineering Group [email protected] http://math.ut.ee/~mazzucco

Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

Introduction to Performance Engineering and Modeling

Dr. Michele Mazzucco Software Engineering Group

[email protected] http://math.ut.ee/~mazzucco

Page 2: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Whetheryoudesign,build,test,maintain,ormanageapplications,youneedtomanageperformance*  Performanceisamake‐or‐breakqualityforsoftware*  Ifyoudon’tknowyourperformanceobjectives,youareunlikelytomeet

them*  Performanceaffectsdifferentrolesindifferentways,e.g.*  Asanarchitect:balanceperformanceandscalability*  Asadeveloper:isthesystemoptimized“enough”?*  Asatester:validatewhetherthesystemsupportstheexpectedworkload*  Asasystemadministrator:isthesystemmeetingitsperformancegoals?

*  Performanceengineeringincludesroles,skills,activities,practicesandtoolsaimingatensuringthatperformanceobjectivesaremet

WhatisPerformanceEngineering?

2

Page 3: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Performancefailurescostthesoftwareindustrymillionsofdollarseveryyear.Theyinclude

1.  Increasedoperationalcosts2.  Increaseddevelopmentcosts3.  Increasedhardwarecosts4.  Canceledprojects5.  Damagedcustomersrelationships6.  Reducedcompetiveness,and

7.  Lostincome

WhytoModelPerformance?(1)

3

Page 4: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Performanceisaboutriskmanagement*  Youhavetodecidehowimportantperformanceistothesuccessofyoursystemorapplication

*  Waitingtimesincreaseasthesystemgetsmoreandmorecongested.*  Needtounderstandhowcongestionaffectsperformance!*  Differentframeworksexiststomodelperformance

*  IwillfocusonQueuingTheory

WhytoModelPerformance?(2)

4

Page 5: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

Aqueue

Alongqueue

Apriorityqueue

5

Page 6: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

Aqueue

Alongqueue

Apriorityqueue

*  Queuingtheoryprovidesprobabilisticanalysisofthesequeues,e.g.*  Averagelength*  Averagewaitingtime*  Probabilitythatthequeueisatacertainlength*  Probabilitythatajobwillhavetoqueue

6

Page 7: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

Aqueue

Alongqueue

Apriorityqueue

*  Queuingtheoryprovidesprobabilisticanalysisofthesequeues,e.g.*  Averagelength*  Averagewaitingtime*  Probabilitythatthequeueisatacertainlength*  Probabilitythatajobwillhavetoqueue

7

ExampleofPriorityQueueAnelectricalutilitycompanyusessixcustomerservicerepresentatives(CSRs)atitscallcentertohandletelephonecallsandinquiriesfromitstop350businesscustomers.Thenexttierof700businesscustomersisalsohandledbysixCSRs.Basedonthecustomer’scode,thecallcenterroutesbusinesscustomerstodifferentqueuesandCSRs.Amanagerattheutilityexplains:“Wedon’tignoreanyone,butourbiggestcustomerscertainlygetmoreattentionthantherest.”

Page 8: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ApplicationsofQueuingTheory

* Telecommunications(e.g.,publicswitchedtelephonenetwork)* Trafficcontrol,transport,logistics* Healthservices(e.g.,controlofhospitalbedassignments)* Airporttraffic,airlineticketsales* Customerservice,callcenters*  Layoutofmanufacturingsystems* …and* Modelingcomputersystems’performance

8

Page 9: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ExampleApplicationofQueuingTheory–TrafficLights

*  Howdowehavetoregulatetrafficlightssuchthatthewaitingtimesareacceptable?

9

Page 10: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ExampleApplicationofQueuingTheory‐TheFoodStore

*  Howlongdocustomershavetowaitatthecheckouts?*  Whathappenswiththewaitingtimeduringpeak‐hours?*  Arethereenoughcheckouts?

10

Page 11: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ExampleApplicationofQueuingTheory–ThePostOffice

*  Inapostofficetherearecountersspecializedine.g.stamps,packages,financialtransactions,etc.*  Arethereenoughcounters?

Separatequeuesoronecommonqueueinfrontofcounterswiththesamespecialization?

11

Page 12: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ExampleApplicationofQueuingTheory–TheCallCenter

*  Questionsbyphone,regardinginsuranceconditions,arehandledbyacallcenter.Thiscallcenterhasateamstructure,whereeachteamhelpscustomersfromaspecificregiononly.*  Howlongdocustomershavetowaitbeforeanoperatorbecomes

available?*  Isthenumberofincomingtelephonelinesenough?*  Arethereenoughoperators?*  Poolingteams?

12

Page 13: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Capacityproblemsareverycommoninindustryandoneofthemaindriversofprocessredesign*  Needtobalancethecostofincreasedcapacityagainstthegainsof

increasedproductivityandservice

*  Queuingandwaitingtimeanalysisisparticularlyimportantinservicesystems*  Largecostsofwaitingandoflostsalesduetowaiting

PrototypeExample–Hospital’sER*  Patientsarrivebyambulanceorbytheirown*  Onedoctorisalwaysonduty*  Moreandmorepatientsseekhelp⇒longerwaitingtimes Question:Shallweaddanotherdoctor?

WhyisQueuingAnalysisimportant?

13

Page 14: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ACost/CapacityTradeoffModel

Process capacity

Cos

t

Cost of waiting

Cost of service

Total cost

14

Page 15: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ComponentsofaQueuingSystem(1)

CallingPopulation Queue Service

Mechanism

InputSource TheQueuingSystem

Jobs

ArrivalProcess

QueueConfiguration

QueueDiscipline

ServedJobs

ServiceProcess

leavethesystem

15

Page 16: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ComponentsofaQueuingSystem(2)

*  Thecallingpopulation*  Thepopulationfromwhichcustomers/jobsoriginate*  Thesizecanbefiniteorinfinite(thelatterismostcommon)*  Canbehomogeneous(i.e.,onlyonetypeofcustomers/jobs)or

heterogeneous(i.e.,severaldifferentkindsofcustomers/jobs)

*  TheArrivalProcess*  Determineshow,whenandwherecustomers(jobs)arrivetothesystem*  Animportantcharacteristicisthedistributionoftheinter‐arrivalintervals*  Denotebyλtherateatwhichjobsenterthesystem(e.g.,1job/6secs.)*  1/λistheaverageintervalbetweensuccessivejobarrivals(e.g.,6secs.)16

Page 17: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ComponentsofaQueuingSystem(3)

* Thequeueconfiguration*  Specifiesthenumberofqueues* Singleormultiplelinestoanumberofservicestations

*  Theireffectoncustomerbehavior* Balking,renegingandjockeying* Theirmaximumsize(#ofjobsthequeuecanhold)

17

Page 18: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ExampleofPossibleConfigurations

Servers

MultipleQueues

Servers

SingleQueue

18

Page 19: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ExampleofPossibleConfigurations

Servers

MultipleQueues

Servers

SingleQueue

1.  Theprovidedservicecanbedifferentiated

2.  Laborspecializationpossible3.  Customershavemoreflexibility4. Balkingbehaviormaybe

deterred

1.  Guaranteesfairness*  FIFOappliedtoallarrivals

2.  Nocustomeranxietyregardingchoiceofqueue

3.  Themostefficientsetupforminimizingtimeinthequeue

4.  Jockeying(lineswitching)isavoided

19

Page 20: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ComponentsofaQueuingSystem(4)

* TheServiceMechanism*  Caninvolveoneormoreservers*  Thesizeofthejobisitsservicerequirement*  Theaverageservicerate(e.g.,1/jobsize)isdenotedasμ

* Thequeuediscipline*  Specifiestheorderinwhichjobswillbeserved*  MostcommonlyusedprincipleisFIFO*  Otherrulesare,forexample,PS,LIFO,SJF,…*  Canentailprioritizationbasedoncustomertype

20

Page 21: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

KendalNotation

Sixparametersinshorthand*  Firstthreetypicallyused,unlessspecified1.  ArrivalDistribution*  Probabilityofanewjobarrivesintimet

2.  ServiceDistribution*  Probabilitydistributionjobisservicedintimet

3.  Numberofservers4.  TotalCapacity(infiniteifnotspecified)5.  PopulationSize(infinite)6.  ServiceDiscipline(FCFS/FIFO)

21

Page 22: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

KendalNotationExamples

* M/M/1*  Exponentialarrivalsandservice,1server,infinitecapacityandpopulation,FCFS(FIFO)

* M/M/n*  Sameasbefore,butnservers

* G/G/3/20/1500/SJF*  Generalarrivalandservicedistributions,3servers,17queueslots(20‐3),1500totaljobs,ShortestJobFirst

22

Page 23: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

Little’sLaw

*  Theaveragenumberofcustomersinastablesystemisequaltotheaveragearrivalratemultipliedbytheaveragetimeacustomerspendsinthesystem,L=λW,where*  L:averagenumberofjobsinthesystem*  λ:arrivalrate*  W:averageresponsetime(timeinthesystem)

*  Examples:1.  Onrainydays,streetsandhighwaysaremorecrowded2.  Fastfoodrestaurantsneedasmallerdiningroomthanregular

restaurantswiththesamecustomerarrivalrate23

Page 24: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ExampleusingLittle’sLaw(1)

* Amusementpark*  Peoplearrive,spendtimeatvarioussites,andleave

* Theypay$1perunittimeinthepark* Therateatwhichtheparkearnsis$Lperunittime* Therateatwhichpeoplepayis$λWperunittime* Overalonghorizon*  Rateofparkearnings=Rateofpeople’spayment,or*  L=λ W 24

Page 25: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ExampleusingLittle’slaw(2)

*  Thereare120carsinfrontoftheLincolnTunnel

*  32cars/minutedepartoveraperiodwheretherearenocarsatthestartorendofthetunnel(e.g.securitychecks)

*  Whatisaveragetimerequiredtogothroughthetunnel?

W=L/λ=120/32=3.75minutes

25

Page 26: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

Load,StabilityandSteady‐State

*  Aqueueingsystemisstableif arrival rate < system capacity

*  Forasinglequeue,theratio arrival rate / system capacity iscalled“utilization”(or“load”),andisdenotedasρ(ρ=λ/μ)*  Itdescribesthefractionoftimethefacilityisused*  Asλincreases,thewaitingtimeincreases*  Asμincreases,thewaitingtimedecreases*  Ifthereis1server,werequireλ≤μ(weassumeλ<μ,i.e.ρ<1)*  Whathappensifλ>μ?*  Thesystemisunstable,andeitherthequeuesizegrowsunbound,or

jobsgetdropped!*  Stablesystemswithtime‐stationaryarrivaltrafficapproacha

steady‐state(statisticalequilibrium)26

Page 27: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  ConsideranM/M/1queuewitharrivalrateλandservicerateμ*  λ=expecteddemandperunittime*  μ=expectedcapacityperunittime

*  Similarly,iftherearenserversinparallel,i.e.,anM/M/nqueue,theexpectedcapacityisnμ

UtilizationFactor

! =Capacity Demand

Available Capacity=

"

n!µ27

Page 28: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  SteadyStatecondition*  Enoughtimehaspassedforthesystemstatetobeindependent

oftheinitialstateaswellastheelapsedtime*  Theprobabilitydistributionofthestateofthesystemremains

thesameovertime(i.e.,itisstationary)

*  Transientcondition*  Prevalentwhenaqueuingsystemhasrecentlybegunoperations*  Thestateofthesystemisgreatlyaffectedbytheinitialstateand

bythetimeelapsedsinceoperationsstarted*  Theprobabilitydistributionofthestateofthesystemchanges

withtime

SteadyState

QueuingTheoryanalyzessteadystatebehavior28

Page 29: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

TransientVSSteadyState

29

Page 30: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

DelayisCausedbyJobInterference

*  Ifarrivalsareregularorsufficientlyspacedapart,noqueuingdelayoccurs

Deterministic traffic

Variable but spaced apart traffic

Time

Arrival Times

Departure Times

1 3 42

1 3 42

Time

Arrival Times

Departure Times

1 3 42

1 3 42

30

Page 31: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

BurstinessCausesInterference

*  Notethatdeparturesarelessburstythanarrivals

Time

Queuing Delays

Bursty Traffic

1 2 3 4

1 2 3 4

*  Queuingresultsfromvariabilityinservicetimesand/orinterarrivalintervals

31

Page 32: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

BurstinessExampleDifferentBurstinessLevelsatSameArrivalRate

Source: Fei Xue and S. J. Ben Yoo, UCDavis, “On the Generation and Shaping Self-similar Traffic in Optical Packet-switched Networks”, OPNETWORK 2002 32

Page 33: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

JobSizeVariationCausesInterference

*  Deterministicarrivals,variablejobsizes

Time

Queuing Delays

33

Page 34: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

HighUtilizationExacerbatesInterference

*  Thequeuingprobabilityincreasesastheloadincreases

Time

Queuing Delays

34

Page 35: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ThePoissonProcess

* ThestandardassumptioninmanyqueuingmodelsisthatthearrivalprocessisPoisson* PoissonProcess:thetimesbetweenarrivalsareindependent,identicallydistributedandexponential*  P(arrival<t)=1–e‐λt* Keyproperty*  Memoryless:thepaststatedoesnothelptopredictthefuture*  Thefactthatacertaineventhasnothappenedyettellsusnothingabouthowmuchlongeritwilltakebeforeitdoeshappen*  e.g.,P(X>40|X>=30)=P(X>10)35

Page 36: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

Birth‐and‐DeathProcesses(1)

*  Thefoundationofmanyofthemostcommonlyusedqueuingmodels

  Birth–equivalenttothearrivalofacustomerorjob  Death–equivalenttothedepartureofaservedcustomerorjob

Assumptions1.  GivenN(t)=n,

  Thetimeuntilthenextbirth(TB)isexponentiallydistributedwithparameterλn(customersarriveaccordingtoaPo‐process)

  Theremainingservicetime(TD)isexponentiallydistributedwithparameterµn

2.  TB&TDaremutuallyindependentstochasticvariablesandstatetransitionsoccurthroughexactly*  oneBirth(n→n+1),or*  oneDeath(n→n–1)

36

Page 37: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

λ0 λ1 λn‐1 λn

0 1 2 n‐1 n n+1

µ1 µ2 µn µn+1

n =Staten,i.e.,thecaseofncustomers/jobsinthesystem

Birth‐and‐DeathProcesses(2)

*  Ratediagram*  ExcellenttoolfordescribingthemechanicsofaBirth‐

and‐Deathprocess

37

Page 38: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Insteadystatethefollowingbalanceequationmustholdforeverystaten(provedviadifferentialequations)

*  Also,theprobabilityofbeinginoneofthestatesmustequalto1(normalizingequation)

SteadyStateAnalysisofB‐DProcesses(1)

pi=1

i=0

!

"

RateIn=RateOut,i.e.,Averageentrancerate=Averagedeparturerate

38

Page 39: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

SteadyStateAnalysisofB‐DProcesses(2)

State BalanceEquation

0

1

n

Normalization : pi = p0 1+!0

µ1

+!0!1

µ1µ2

+!0!1!2

µ1µ2µ3

+!!

"#

$

%&

i=0

'

( =1

C0 C239

Page 40: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

TheM/M/1Queue(1)*  SingleserverservingjobsinaFIFOmanner

*  Mstandsfor“Markovian”*  M/M/1standsforPoissonarrivalprocess*  M/M/1standsforexponentiallydistributedservicetimes*  Eachjobmustwaitforalljobsfoundinthesystemto

complete,beforebeingserved*  DepartureTime=ArrivalTime+WorkloadFoundintheSystem+

Servicetime40

Page 41: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Bysolvingthebalanceequationsweobtainthesteady‐stateprobabilityofthenumberofjobsinthesystem*  pj=ρj(1‐ρ)

*  Otherperformancemeasures*  L=ρ/(1–ρ)*  W=1/(μ‐λ)

41

TheM/M/1Queue(2)

0

10

20

30

40

50

60

70

80

90

100

0 0.2 0.4 0.6 0.8 1

Avg. no. of

jobs

in t

he

syst

em

Load, !

Number of jobs in the system

Page 42: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

Example1:HowDelayScaleswithSystemcapacity

*  Occupancyanddelayformulas ρ =λ/µ L=ρ/(1‐ρ) W=1/(µ‐λ)

*  Supposethatweincreasebothλandµbyafactorofk*  WhathappenstoL?AndtoW?1.  λ=0.8andµ=1sec.=>ρ = 0.8*  L=0.8/0.2=4,

*  λ=1.6andµ=2=>ρ=0.8*  L=0.8/0.2=4,

*  Why?*  Becausebyspeedinguparrivalsbyfactorofkandspeedingupservicetimesbyafactorofk,we’rebasicallyjustspeedingupour‘clockspeed’byafactorofk

42

W=1/0.2=5sec.

W=1/0.4=2.5sec.K=2

Page 43: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Question*  Whatisthemaximumallowableλ,giventhat1/μ=4minutes

andtheaveragewaitingtimemustbelessthan8minutes?

*  W=servicetime+waitingtime<4+8=12minutes*  W=1/(µ‐λ)=1/(μ‐λ)<12*  (μ‐λ)>1/12*  λ<μ–1/12=(3‐1)/12*  λ<2/12=1/6jobs/minute

*  Proof*  W=1/(1/4‐1/6)=1/(0.25–0.16667)=12minutes,or*  ρ=1/6×4=2/3≅0.67=>L=0.67/0.33≅2=>W=2×6=12min.

43

Example2–GuaranteeingQoSviaTrafficShaping

Page 44: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

Multi‐ServersQueues

*  Multiplejobsareservedsimultaneouslyonmultipleservers*  Headofthelineservice:jobswaitinaFIFOqueue,

andwhenaserverbecomesfree,thefirstjobgoesintoservice

44

!

Queue

Service

"

"

"

...

Page 45: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  GeneralizationoftheM/M/1queue

*  ThesolutionofthebalanceequationsandtheassociatedformulaeforcomputingtheperformancemeasuresaremorecomplicatedthanintheM/M/1case

45

TheM/M/nqueue

0

λ λ λ λ

µ 2µ (n‐1)µ nµ

1 nn‐22 n+1

λ

n‐1

(n‐2)µ

Page 46: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  PatientsarriveaccordingtoaPoissonprocesswithrateλ=2patientsperhour*  Theservicetime(e.g.,thetimeittakesadoctortovisit/

treatapatient)isexponentiallydistributedwithmean1/μ=20minutes*  TheERcanbemodeledasanM/M/nqueuewheren=no.

ofdoctors*  Questions*  Currentlyonly1doctorisonduty.Shallweaddanother

one?*  Howisthesystem’sperformanceaffectedbyanincreasein

servicecapacity(e.g.,moredoctors)? 46

Example1

Page 47: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Interpretation*  Tobeinthequeue=tobeinthewaitingroom*  Tobeinthesystem=tobeintheER(waitingorundertreatment)

47

Example1‐Summaryofresults

Characteristic One doctor (n=1) Two doctors (n=2) ρ 2/3 1/3 p0 1/3 1/2

(1-p0) 2/3 1/2 p1 2/9 1/3 Lq 4/3 patients 1/12 patients L 2 patients 3/4 patients w 2/3 h = 40 minutes 1/24 h = 2.5 minutes W 1 h 3/8 h = 22.5 minutes

Page 48: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

48

*  Thearrivalrateisλ*  Thetotalservicerateis2μ=>stabilityconditionρ=λ/μ<2

*  Whichconfigurationisbetter?*  ThemetricofinterestifL(avg.no.ofjobs)

! 2"

!/2 "

!/2 "

!

"

"

(c) Two M/M/1 Queues(a) M/M/1 Queue (b) M/M/2 Queue

Example2(1)

Page 49: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

a)  M/M/1queuewithofferedload=ρ/2*  La=ρ/(2‐ρ)

b)  M/M/2queue*  Lb=4ρ/[(2‐ρ)(2+ρ)]

c)  2independentM/M/1queues*  Theofferedloadateachqueueisρ/2*  Lc=2×[ρ/(2–ρ)]

*  Whichconfigurationisbetter?

49

Example2(2)

Page 50: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

a.  M/M/1:La=ρ/(2‐ρ),b.  M/M/2:Lb=4p/[(2‐ρ)(2+ρ)],orc.  2M/M/1:Lc=2×[ρ/(2–ρ)]?* Setρ=1,henceweobtain*  1<4/3<2,i.e.* La<Lb<Lc* Why?* Becausetheprocessingpowerofann‐seversystemisfullyutilizedONLYwhenallserversarebusy,whichrequiresatleastnjobsintheM/M/nqueue,andatleastnnon‐emptyqueuesinsystem(c)

50

Example2(3)

Page 51: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  AM/M/nsystemwithnoqueue*  Ifallserversarebusy,jobsarelost!*  Examples*  Awaitingroomwithlimitedcapacity(e.g.,thehospital’s

ER)*  Atelephonesystemwhichcanhandleatmostncalls

simultaneously

*  TheM/M/n/nqueueisalwaysstable,nomatterwhattheofferedloadis!

51

TheM/M/n/nQueue(1)

Page 52: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Thestatediagramhasexactlynstates

*  Thegeneralexpressionsforthesteadystateprobabilities,waitingtimes,queuelengthsetc.areobtainedthroughthebalanceequationsasbefore(RateIn=RateOut;foreverystate)*  ThekeyquestionforM/M/n/nqueuesis“whatisthe

blockingprobability?”,e.g.,whatisthefractionofjobsthatarelost?

52

TheM/M/n/nQueue(2)

0

λ λ λ

µ 2µ (n‐1)µ

1 n‐12 n

λ λ

Page 53: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Istheblockingprobabilityaffectedbyn?

53

TheM/M/n/nQueue(3)

0

0.1

0.2

0.3

0.4

0.5

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Blo

ckin

g p

rob

abil

ity

, p

n

Load, !

n=1

Page 54: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

0

0.1

0.2

0.3

0.4

0.5

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Blo

ckin

g p

rob

abil

ity

, p

n

Load, !

n=1n=10

*  Istheblockingprobabilityaffectedbyn?

54

TheM/M/n/nQueue(3)

Page 55: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

0

0.1

0.2

0.3

0.4

0.5

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Blo

ckin

g p

rob

abil

ity

, p

n

Load, !

n=1n=10

n=100

*  Istheblockingprobabilityaffectedbyn?

55

TheM/M/n/nQueue(3)

Page 56: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

0

0.1

0.2

0.3

0.4

0.5

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Blo

ckin

g p

rob

abil

ity

, p

n

Load, !

n=1n=10

n=100n=1,000

*  Istheblockingprobabilityaffectedbyn?

56

TheM/M/n/nQueue(3)

Page 57: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

0

0.1

0.2

0.3

0.4

0.5

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Blo

ckin

g p

rob

abil

ity

, p

n

Load, !

n=1n=10

n=100n=1,000

n=10,000

*  Istheblockingprobabilityaffectedbyn?

57

TheM/M/n/nQueue(3)

Page 58: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Designofqueuingsystemsusuallyinvolvesomekindofcapacitydecision*  Thenumberofservicestations*  Thenumberofserversperstation*  Theservicetimeforindividualservers⇒ Thecorrespondingdecisionvariablesareλ,nandµ

*  Examples:*  Thenumberofdoctorsinahospital,*  Thenumberofexitsandcashiersinasupermarket,*  Thechoiceofmachinetypeatanewinvestmentdecision,*  Thelocalizationoftoiletsinanewbuilding,etc…

QueuingModelingandSystemDesign(1)

58

Page 59: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Twofundamentalquestionswhendesigning(queuing)systems*  Whichservicelevelshouldweaimfor?*  Howmuchcapacityshouldweacquire?

*  Thecostofincreasedcapacitymustbebalancedagainstthecostreductionduetoshorterwaitingtime⇒  Specifyawaitingcostorashortagecostaccruingwhen

customershavetowaitforserviceor…⇒  …Specifyanacceptableservicelevelandminimizethe

capacityunderthiscondition

*  Theshortageorwaitingcostrateissituationdependentandoftendifficulttoquantify*  Shouldreflectthemonetaryimpactadelayhasonthe

organizationwherethequeuingsystemresides

QueuingModelingandSystemDesign(2)

59

Page 60: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Auniversityisabouttoleaseasupercomputer*  Twoalternativesareavailable*  TheMcomputerwhichismoreexpensivetoleasebutalsofaster*  TheCcomputerwhichischeaperbutslower*  Processingtimesandtimesbetweenjobarrivalsareexponential⇒M/M/1model*  λ=20jobsperday*  µM=30jobsperday,µC=25jobsperday*  Theleasingandwaitingcosts:*  Leasingprice:CM=$500perday,CC=$350perday*  Thewaitingcostperjobandtimeunitjobisestimatedto$50perjob

andday *  Question:*  Whichcomputershouldtheuniversitychooseinordertominimize

theexpectedtotalcost?

ComputerProcurement(1)

60

Page 61: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Settings*  λ=20jobs/day*  μM=30jobs/day,μC=25jobs/day*  CM=500$/day,CC=350$/day,WC=50$/jobperday

*  Results*  ρ=λ/μ=>ρM=0.667,ρC=0.8*  L=ρ/(1–ρ)=>LM=2,LC=4*  WCM=100$/day,WCC=200$/day*  Costoption1=600$/day,option2=550$/day

ComputerProcurement(2)

61

Page 62: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

62

Page 63: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

400

600

800

1000

1200

1400

1600

1800

0 5 10 15 20 25

Tot

al C

ost

($/d

ay)

! (jobs/day)

Holding cost = 40 $/day

LargeSmall

63

Page 64: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

400

600

800

1000

1200

1400

1600

1800

0 5 10 15 20 25

Tot

al C

ost

($/d

ay)

! (jobs/day)

Holding cost = 50 $/day

LargeSmall

64

Page 65: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

400

600

800

1000

1200

1400

1600

1800

0 5 10 15 20 25

Tot

al C

ost

($/d

ay)

! (jobs/day)

Holding cost = 60 $/day

LargeSmall

65

Page 66: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

ResourceAllocationforPowerandPerformance

*  Sservers

66

  narerunning  (S‐n)areswitchedoff

  Userspayachargeproportionaltothejobsize(unknownapriori)

  Eachuserpaysc$perunittimeperserver  Runningserversconsumeelectricity,whichcostsr$/kWh  Ifallserversarebusy,furtherjobsarelost  Howtochoosethe“best”n?

Page 67: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  Supposewehaveacollectionofserversprovidingacertainnumberofservices

67

QoSProvisioningviaResourceAllocation+AdmissionControl

*  Howdoweallocatetheavailableresourcesinthemostefficientway?*  Shallweacceptthenext

incomingrequest?

1.  Foreachacceptedandcompletedjoboftypei,ausershallpayachargeofci

2.  TheresponsetimeWi(orwaitingtimewi)ofanacceptedjobshallnotexceedqi

3.  Foreachjoboftypeiwhoseresponsetime(waitingtime)exceedsqi,theprovidershallpayapenaltyofri

Page 68: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

1.  “AnalyticalPerformanceModelingforComputerSystems”,http://www.morganclaypool.com/doi/abs/10.2200/S00282ED1V01Y201005CSL002

2.  “CallCenterMathematics”,http://www.cs.vu.nl/~koole/ccmath/book.pdf

3.  “IntroductiontoQueueingTheoryandStochasticTeletrafficModels”,http://www.ee.cityu.edu.hk/~zukerman/classnotes.pdf

4.  “IntroductiontoQueueingTheoryandMathematicalModelling”,http://www.cs.auckland.ac.nz/courses/compsci742s2c/lectures/handout‐n‐q.pdf

68

References(1)

Page 69: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

5.  “M/M/n/KQueueingSystem”,http://ingforum.haninge.kth.se/armin/ALLA_KURSER/KOTEORI/EXER/repet5.pdf

6.  “QueueingTheory”,http://www.win.tue.nl/~iadan/queueing.pdf

7.  “TeletrafficEngineeringandNetworkPlanning”,http://oldwww.com.dtu.dk/teletraffic/handbook/telenook.pdf

8.  “GrinsteadandSnell’sIntroductiontoProbability”,http://www.math.dartmouth.edu/~prob/prob/prob.pdf

69

References(2)

Page 70: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

*  PDQ:PrettyDamnQuick,http://www.perfdynamics.com/Tools/PDQ.html*  TheRProjectforStatisticalComputing,

http://www.r‐project.org/*  qnetworks–aQueueingNetworksanalysispackagefor

GNUOctave,http://www.moreno.marzolla.name/software/qnetworks/*  Queueingsimulation,

http://www.stat.auckland.ac.nz/~stats255/qsim/qsim.html*  JavaModellingTools,http://jmt.sourceforge.net/*  Amorecompletelistoftheavailabletoolscanbefoundat

http://web2.uwindsor.ca/math/hlynka/qsoft.html

70

FreeTools

Page 71: Introduction to Performance Engineering and Modeling · 2011-11-24 · theory provides probabilistic analysis of these queues, e.g. * Average length * Average waiting time * Probability

[email protected] http://math.ut.ee/~mazzucco

71