Queuing Theory Gonzalo Mateos Dept. of ECE and Goergen Institute for Data Science University of Rochester gmateosb@ece.rochester.edu http://www.ece.rochester.edu/~gmateosb/ November 16, 2018 Introduction to Random Processes Queuing Theory 1
Queueing theory Queuing theory M/M/1 queue Multiserver queues Networks of queues Introduction to Random Processes Queuing Theory 2
Queues ◮ Queuing theory is concerned with the (boring) issue of waiting ⇒ Waiting is boring, queuing theory not necessarily so ◮ “Customers” arrive to receive “service” by “servers” ⇒ Between arrival and start of service wait in queue ◮ Quantities of interest (for example) ⇒ Number of customers in queue ⇒ L (for length) ⇒ Time spent in queue ⇒ W for (wait) ◮ Queues are a pervasive application of CTMCs λ µ Introduction to Random Processes Queuing Theory 3
Where do queues appear? ◮ Queues are fundamental to the analysis of (public) transportation ◮ Wait to enter a highway ⇒ Customers = cars ◮ Q: Subway travel times, subway or buses? ◮ Q: Infrequent big buses or frequent small buses? ◮ Packet traffic in communication networks ◮ Route determination, congestion management ◮ Real-time requirements, delays, resource management ◮ Logistics and operations research ◮ Customers = raw materials, components, final products ◮ Customers in queue = products in storage = inactive capital ◮ Customer service ◮ Q: How many representatives in a call center? Call center pooling Introduction to Random Processes Queuing Theory 4
Examples of queues ◮ Simplest rendition ⇒ Single queue, single server, infinite spots ⇒ Simpler if arrivals and services are Poisson ⇒ M/M/1 queue ⇒ Limiting number of spots not difficult ⇒ Losses appear λ µ ◮ Multi-server queues ⇒ Single queue, many servers ⇒ M/M/c queue ⇒ c Poisson servers (i.e., exp. service times) µ 1 λ µ 2 Introduction to Random Processes Queuing Theory 5
Networks of queues ◮ Groups of interacting queues ⇒ Applications become interesting Ex: A queue tandem λ µ 1 µ 2 ◮ Can have arrivals at different points and random re-entries µ 13 λ 1 λ 3 µ 10 µ 12 λ 2 Exit ◮ Batch service and arrivals, loss systems (not considered) Introduction to Random Processes Queuing Theory 6
M/M/1 queue Queuing theory M/M/1 queue Multiserver queues Networks of queues Introduction to Random Processes Queuing Theory 7
M/M/1 queue ◮ Arrival and service processes are Poisson ⇒ Birth & death process a) Customers arrive at an average rate of λ per unit time b) Customers are serviced at an average rate of µ per unit time c) Interarrival and inter-service time are exponential and independent λ µ ◮ Hypothesis of Poisson arrivals is reasonable ◮ Hypothesis of exponential service times not so reasonable ⇒ Simplifies the analysis. Otherwise, study a M/G/1 queue ◮ Steady-state behavior (systems operating for a long time) ⇒ Q: Limit probabilities for the M/M/1 system? Introduction to Random Processes Queuing Theory 8
CTMC model ◮ Define CTMC by identifying states Q ( t ) with queue lengths ⇒ Transition rates q i , i +1 = λ for all i , and q i , i − 1 = µ for i � = 0 ◮ Recall that first of two exponential times is exponentially distributed ⇒ Mean transition times are ν i = λ + µ for i � = 0 and ν 0 = λ λ λ λ λ 0 i − 1 i +1 i . . . . . . µ µ µ ◮ Limit distribution equations (Rate out of j = Rate into j ) λ P 0 = µ P 1 , ( λ + µ ) P i = λ P i − 1 + µ P i +1 Introduction to Random Processes Queuing Theory 9
Queue length as a function of time ◮ Simulation for λ = 30 customers/min, µ = 40 services/min ◮ Probability distribution estimated by sample averaging with M = 10 5 M P ( Q ( t ) = k ) ≈ 1 � I { Q i ( t ) = k } M i =1 ◮ Steady state (in a probabilistic sense) reached in around 10 3 mins. ◮ Queue length vs. time. Probabilities are color coded ⇒ Mean queue length shown in white Introduction to Random Processes Queuing Theory 10
Close up on initial times ◮ Probabilities settle at their equilibrium values 11 1 10 0.9 9 0.8 8 0.7 7 Queue Length 0.6 6 0.5 5 4 0.4 3 0.3 2 0.2 1 0.1 0 0 200 400 600 800 1000 1200 1400 Time (seconds) 1 Pr[L=0] 0.9 Pr[L=1] Pr[L=2] 0.8 Pr[L=3] Pr[L=4] 0.7 0.6 Probability 0.5 0.4 0.3 0.2 0.1 0 0 500 1000 1500 Time (seconds) Introduction to Random Processes Queuing Theory 11
Another view of queue length evolution ◮ Cross-sections of queue length probabilities at different times t = 0 t = 30 t = 60 t = 90 1 1 1 1 0.8 0.8 0.8 0.8 Probability Probability Probability Probability 0.6 0.6 0.6 0.6 0.4 0.4 0.4 0.4 0.2 0.2 0.2 0.2 0 0 0 0 0 5 10 0 5 10 0 5 10 0 5 10 Queue Length Queue Length Queue Length Queue Length t = 120 t = 150 t = 180 t = 210 1 1 1 1 0.8 0.8 0.8 0.8 Probability Probability Probability Probability 0.6 0.6 0.6 0.6 0.4 0.4 0.4 0.4 0.2 0.2 0.2 0.2 0 0 0 0 0 5 10 0 5 10 0 5 10 0 5 10 Queue Length Queue Length Queue Length Queue Length Introduction to Random Processes Queuing Theory 12
Ergodicity ◮ Compare ensemble averages for large t with ergodic averages � t T i ( t ) = 1 I { Q ( τ ) = i } d τ t 0 0.6 Ensemble average Ergodic average 0.5 0.4 Probability 0.3 0.2 0.1 0 0 2 4 6 8 10 Queue Length ◮ They are approximately equal, as they should (equal as t → ∞ ) Introduction to Random Processes Queuing Theory 13
A non stable queue ◮ All former observations valid for stable queues ( λ < µ ) ◮ Simulation for λ = 60 customers/min and µ = 40, customers/min ⇒ Queue length grows unbounded ⇒ Probability of small number of customers in queue vanishes ⇒ Actually CTMC transient, P i → 0 for all i ◮ Queue length vs. time. Probabilities are color coded ⇒ Mean queue length shown in white Introduction to Random Processes Queuing Theory 14
Solution of limit distribution equations ◮ Start expressing all prob. in terms of P 0 . Definie traffic intensity ρ := λ/µ ◮ Repeat process done for birth and death process ◮ Equation for P 0 ⇒ λ P 0 = µ P 1 ⇒ λ P 0 = µ P 1 ◮ Sum eqs. for P 1 ⇒ and P 0 ( λ + µ ) P 1 = λ P 0 + µ P 2 ⇒ λ P 1 = µ P 2 ◮ Sum result and ⇒ λ P 1 = µ P 2 eq. for P 2 ( λ + µ ) P 2 = λ P 1 + µ P 3 ⇒ λ P 2 = µ P 3 ◮ Sum result and ⇒ λ P i − 1 = µ P i eq. for P i ( λ + µ ) P i = λ P i − 1 + µ P i +1 ⇒ λ P i = µ P i +1 ◮ From where it follows ⇒ P i +1 = ( λ/µ ) P i = ρ P i and recursively P i = ρ i P 0 Introduction to Random Processes Queuing Theory 15
Solution of limit distribution equations (continued) ◮ The sum of all probabilities is 1 (use geometric series formula) ∞ ∞ P 0 � � ρ i P 0 = 1 = P i = 1 − ρ i =0 i =0 ◮ Solve for P 0 to obtain ⇒ P i = (1 − ρ ) ρ i P 0 = 1 − ρ, ⇒ Valid for λ/µ < 1, if not CTMC is transient (queue unstable) ◮ Expression coincides with non-concurrent queue in discrete time ⇒ Not surprising. Continuous time ≈ discrete time with small ∆ t ⇒ For small ∆ t non-concurrent hypothesis is accurate ◮ Present derivation “much cleaner,” though Introduction to Random Processes Queuing Theory 16
Steady-state expected queue length ◮ To compute expected queue length E [ L ] use limit probabilities ∞ ∞ � � i (1 − ρ ) ρ i E [ L ] = iP i = i =0 i =0 i =0 ix i = x / (1 − x ) 2 ). Then ◮ Latter is derivative of geometric sum ( � ∞ ρ ρ E [ L ] = (1 − ρ ) × (1 − ρ ) 2 = 1 − ρ ◮ Recall λ < µ or equivalently ρ < 1 for queue stability ⇒ If λ ≈ µ queue is stable but E [ L ] becomes very large Introduction to Random Processes Queuing Theory 17
Steady-state expected wait ◮ Customer arrives, L in queue already. Q: Time spent in queue? ⇒ Time required to service these L customers ⇒ Plus time until arriving customer is served L +1 � ◮ Let T 1 , T 2 , . . . , T L +1 be these times. Queue wait ⇒ W = T i i =1 ◮ Expected value (condition on L = ℓ , then expectation w.r.t. L ) � L +1 � � � ℓ +1 �� � � � L = ℓ � E [ W ] = E = E T i E T i i =1 i =1 ◮ L = ℓ “not random” in inner expectation ⇒ interchange with sum � L +1 � � E [ W ] = E E [ T i ] = E [( L + 1) E [ T i ]] = E [ L + 1] E [ T i ] i =1 Introduction to Random Processes Queuing Theory 18
Expected wait (continued) ◮ Use expression for E [ L ] to evaluate E [ L + 1] as ρ 1 E [ L + 1] = E [ L ] + 1 = 1 − ρ + 1 = 1 − ρ ◮ Substitute expressions for E [ L + 1] and E [ T i ] = 1 /µ E [ W ] = 1 1 1 µ × 1 − ρ = µ − λ ◮ Recall λ = arrival rate. Former may be written as E [ W ] = 1 ρ λ × 1 − ρ = (1 /λ ) E [ L ] Introduction to Random Processes Queuing Theory 19
Little’s law ◮ For M/M/1 queue have just seen ⇒ E [ L ] = λ E [ W ] ⇒ Expression referred to as Little’s law ◮ True even if arrivals and departures are not Poisson (not proved) ◮ Expected nr.customers in queue = arrival rate × expected wait Introduction to Random Processes Queuing Theory 20
Multiserver queues Queuing theory M/M/1 queue Multiserver queues Networks of queues Introduction to Random Processes Queuing Theory 21
Recommend
More recommend