Basics of Queueing Theory

Embed Size (px)

DESCRIPTION

Basics of Queueing Theory

Citation preview

  • Basics of Queueing TheoryMaterial from Chapter 2 of Simio and Simulation: Modeling, Analysis, Applications as well as external sources

    Basics of Queueing Theory

  • IntroductionMost (not all) simulations are of queueing systems, or networks of queues, modeling real systemsCustomers show up, wait for service, get served, maybe go elsewhere, wait again, get served again, etc., maybe leaveChapter 2Basics of Queueing Theory*

    SystemCustomersServersManufacturingPartsMachines, people, transportUrgent-care clinicPatientsDoctors, nurses, other staff, roomsSupply chainParcels, loads, trucksDocks, warehouse space, trucksBankCustomersTellers, loan officers, drive-throughsAmusement parkGuestsRides, food stands, urgent-care clinicComputer labStudentsComputers, printers, help staffTelecommunicationsMessages, packetsTerminals, relays, switchesTraffic intersectionVehicles, pedestriansSegments of space in the intersection

    Basics of Queueing Theory

  • A Single-Server Queueing SystemChapter 2Basics of Queueing Theory*Often interested in output performance measures (metrics), likeTotal number of patients going from entry to exit over a fixed time periodAverage time in queue (waiting time), not counting service timeMaximum time in queueTime-average number of parts in queue (area under number-in-queue function, divided by length of time period)Maximum number of patients in queue over a fixed time periodAverage patient time in systemMaximum patient time in systemUtilization of the server (proportion of time busy)Could be a node in a larger queueing network

    Interarrival times, service times random (need to specify probability distributions)

    Basics of Queueing Theory

  • Urgent-Care ClinicChapter 2Basics of Queueing Theory*Some questions:How many staff of which type during which time periods?How big should the waiting room(s) be?What would be the effect on patient waits if doctors and nurses tended to decrease or increase the time they spend with patients?What if 10% more patients arrived (arrival rate increased by 10%)?Should we serve patients in order of their acuity, or just first-in-first-out (FIFO)?Random arrivals (no appointments)Branching probabilities (independent)

    Basics of Queueing Theory

  • Why Study Queueing Theory with Simulation?Chapter 2Basics of Queueing Theory*Terminology, logic similar to many simulation modelsIn some cases, can derive exact closed-form formulas for output performance metrics, use to verify (debug) simulation models:Have simulation model of complex system that does not meet queueing-theory assumptions but it would if we made some (over-)simplifying extra assumptions like exponential distributions for inter-arrival and service timesModify the simulation model so that it meets these extra assumptions, run it for a very long time queueing-theoretic results are typically available only for steady state (a.k.a. long run, infinite horizon)Compare simulation output with queueing-theoretic results if they (approximately) agree, then confidence in the simulation is improved.Restore your simulation model back the way it should be!

    Basics of Queueing Theory

  • Entities (like customers, patients, jobs) arrive, get served either at a single station or at several stations, may wait in queue(s), and may leave the system (if they do, its an open system, otherwise if they never leave its closed)Queueing network could consist of several separate queueing stations, each of which is a single- or multiple-server queueIf multiple server, usually assume that a single queue feeds all the parallel servers, and that the servers are identical in service speeds:

    Queue disciplines when an entity can leave the queue and start service, which entity gets to be the next one to be served?First-in, first-out (FIFO), a.k.a. first-come, first-served (FCFS)Last-in, first-out (LIFO) a stack of physical or logical objectsPriority Shortest Job First (SJF); or Maximum Value First (MVF)Queueing-System Structure and TerminologyChapter 2Basics of Queueing Theory*

    Basics of Queueing Theory

  • Queueing-System Performance Metrics(Wq) Time in queue (excluding service time); if in a network, either overall (added up for all queueing waits) or at individual stations(W) Time in system, including time in queue plus service time (again over the network or at a node)(Lq) Number of entities in queue (a.k.a. queue length), not including any entities in service (again, over the network or at a node)(L) Number of entities in system, including in queue plus in service (over network or at a node)() Utilization of a server, or of a group of parallel identical servers, the time-average number of individual servers in the group who are busyChapter 2Basics of Queueing Theory*

    Basics of Queueing Theory

  • Urgent Care Clinic*Basics of Queueing Theory*Kelton et al., 2011, p. 21

    Basics of Queueing Theory

  • Example Single-server Queueing System*Basics of Queueing Theory*RegistrationQueueReg. DeskArrivingpatientsDepartingpatientsPatient beingregistered

    Basics of Queueing Theory

  • Patient Arrival/Registration Time Data*Basics of Queueing Theory*

    PatientArrival TimeIATST10022335341247335147261627719338267293591103837

    Basics of Queueing Theory

  • *Basics of Queueing Theory*Queuing SystemsCommon assumptions:c servers with a single queue with FIFO orderingA1, A2, , An are IID random variables (interarrival times) l is the arrival rateS1, S2, , Sn are IID random variables (service times) m is the service rateAs and Ss are independent r = l/cm is the utilizationA/B/c/k queuing system (Kendalls notation) M/M/1M/M/cM/G/cGI/G/c

    Basics of Queueing Theory

  • *Basics of Queueing Theory*Queuing SystemsDefine the following performance measures:Wqi is the delay in the queue for the ith customerWi = Wqi + Si is the waiting time in the system for the ith customerLq(t) is the number of customers in the queue at time tL(t) is the number of customers in the system at time t (Lq(t) plus the number being served at time t)

    Steady state averagedelay in the queueSteady state averagewaiting time in the system

    Basics of Queueing Theory

  • *Basics of Queueing Theory*Queuing SystemsSteady state time-averagenumber in the queueSteady state time-averagenumber in the systemConservation equations

    Basics of Queueing Theory

  • *Basics of Queueing Theory*M/M/c Queuing FormulaeAskin, R. G. and C. R. Standridge, Modeling and Analysis of Manufacturing Systems, John Wiley & Sons, New York, NY, 1993.

    Basics of Queueing Theory

  • M/G/1 Queuing Formulae*Basics of Queueing Theory*Exponentially distributed interarrival times with rate lGeneral service times with rate m and variance sS2

    Basics of Queueing Theory

  • Queueing NetworksConsist of nodes, each of which is a G/G/c station, connected by arcs representing possible entity travel between nodesCan also have entity arrivals from outside the network, and entities can exit from any node to outside the systemWhen an entity leaves a node, it can go out on any of the arcs emanating from that node, with arc probabilities summing to 1Assume:All arrival processes from outside have exponential interarrival times (a.k.a. Poisson processes), and are independent of each otherAll service times are independent exponential (so each node is an M/M/c)All queue capacities are infiniteUtilization (a.k.a. traffic intensity) locally at each node is < 1Chapter 2Basics of Queueing Theory*Called a Jackson network with these assumptions; much is known about it

    Basics of Queueing Theory

  • Queueing Networks*Basics of Queueing Theory*Kelton et al., 2011, p. 21

    Basics of Queueing Theory

  • Queueing Networks (cont.)Use all of this to analyze each node in a Jackson network as a stand-alone M/M/c queue, using formulae given earlierJust have to compute Poisson arrival input/output rates using decomposition, superposition of Poisson processesLet SignIn be the (Poisson) arrival rate into the Sign In station, assume exponential service times throughout:Chapter 2Basics of Queueing Theory*Analyze each node independently as:Sign In: M/M/2, arrival rate SignIn Registration: M/M/1, arrival rate 0.9SignInTrauma Rooms: M/M/2, arrival rate 0.1SignInExam Rooms: M/M/4, arrival rate 0.9SignInTreatment Rooms: M/M/2, arrival rate (0.9)(0.6)SignIn + 0.1SignIn = 0.64SignIn

    Basics of Queueing Theory

  • Queueing Network Example*Basics of Queueing Theory*l = 20/hrSTA ~ expo(1.875) minSTB ~ expo(4.0) minSTC ~ expo(6.667) min60%40%

    Basics of Queueing Theory

  • Queueing Theory vs. SimulationQueueing-theoretic results have the advantage of being exact, i.e., no statistical uncertainty/variationSimulation results have statistical uncertainty/variation, which needs to be acknowledged and appropriately addressedBut queueing theory has its own shortcomings:Strong assumptions that may be unrealistic, like exponential service times (mode = 0?), making model validity questionableNearly always only for steady-state long-run behavior, so dont address what happens in the short runNot available for all inter-arrival/service distributions, or (more importantly) for complex systems (Jackson network is simple, restrictive)Despite output uncertainty, simulation has major advantages:No restrictions on input distributions, model form, or complexity so model validity is facilitatedCan address short-term time frames in fact, steady-state is harder for simulation (long runs, initialization bias) than for queueing theoryJust have to be mindful of proper statistical design/analysis

    Chapter 2Basics of Queueing Theory*

    Basics of Queueing Theory

    In general, randomness makes systems difficult to model and analyze.

    *Simple queueing system. Generally interested in things like:Total production over a fixed periodAverage time in queue (waiting time)Maximum time in queueTime-average number of parts in queueMaximum number of parts in queue over a fixed periodAverage time in systemMaximum time in systemUtilization of the drill press

    We will generally be interested in networks of queues as we saw in the previous slide.*

    IAT Interarrival timeST Service Time

    **As are the interarrival times and Ss are the service times

    Kendalls notation (A/B/c/k arrival process, service process, num servers, capacity (if not infinite)).

    Rates vs. times show the timeline with arrivals and distinguish between arrival times, interarrival times and arrival rate.*What do we mean by steady state?**As well see throughout the rest of the semester, queueing analysis is very important for validation/verification.

    I give you this formula table for exams. Make sure that you know how to use the formulae.*If we assume:All arrival processes from outside are independent with exponential IAT (Poisson)All service times are exponentially distributed and are independentAll queue capacities are infiniteThe utilization, rho, at each node is strictly less than 1.We have a Jackson Network.

    Under these assumptions, each station can be analyzed independently and the results combined.

    *Discuss times vs rates (IAT vs arrival rate, ST vs service rate)

    Discuss time units (arrival rate given in hours, service times in minutes)

    Analyze individually as M/M/1

    A (20, 32, 1)B (12, 15, 1)C (8, 9, 1)

    Avg. num in sys: 13.667Avg. time in sys: 0.683

    Issues with queueing analysis:AssumptionsExponentialFIFOInfinite queuesProbabilistic branchingSteady-state analysis*