Announcements • PS #3 out this afternoon Queueing Systems: Lecture 1 Amedeo R. Odoni October 4, 2006 • Due: October 19 (graded by 10/23) • Office hours – Odoni: Mon. 2:30-4:30 - Wed. 2:30-4:30 on Oct. 18 (No office hrs 10/16) _ Or send me a message • Quiz #1: October 25, open book, in class • Old quiz problems and solutions: posted on 10/19 • • • • • • • • • • Topics in Queueing Theory Lecture Outline Introduction to Queues Little’s Law Markovian Birth-and-Death Queues The M/M/1 and Other Markovian Variations The M/G/1 Queue and Extensions Priority Queues Some Useful Bounds Congestion Pricing Queueing Networks; State Representations Dynamic Behavior of Queues • Introduction to queueing systems • Conceptual representation of queueing systems • Codes for queueing models • Terminology and notation • Little’s Law and basic relationships • Birth-and-death models • The M/M/1 queueing system Reference: Chapter 4, pp. 182-203 Queues A Generic Queueing System • Queueing theory is the branch of operations research concerned with waiting lines (delays/congestion) • A queueing system consists of a user source, a queue and a service facility with one or more identical parallel servers • A queueing network is a set of interconnected queueing systems • Fundamental parameters of a queueing system: - Demand rate - Capacity (service rate) - Demand inter-arrival times - Service times - Queue capacity and discipline (finite vs. infinite; FIFO/FCFS, SIRO, LIFO, priorities) - Myriad details (feedback effects, “balking”, “jockeying”, etc.) Queueing network consisting of five queueing systems Queueing system 2 In Queueing system 1 Queueing system 3 Point where users merge Point where users make a choice Queueing system 4 + Queueing system 5 Out Servers C Arrival point at the system Queue Source of users/ customers Departure point from the system C C C CC CC C C C C C Arrivals process Size of user source Queue discipline and Queue capacity Service process Number of servers Applications of Queueing Theory • Some familiar queues: _ Airport check-in; aircraft in a holding pattern _ Automated Teller Machines (ATMs) _ Fast food restaurants _ Phone center’s lines _ Urban intersection _ Toll booths _ Spatially distributed urban systems and services • Level-of-service (LOS) standards • Economic analyses involving trade-offs among operating costs, capital investments and LOS • Congestion pricing The Airside as a Queueing Network Queueing Models Can Be Essential in Analysis of Capital Investments Cost Total cost Optimal cost Cost of building the capacity Cost of losses due to waiting Airport Capacity “Optimal” capacity Strengths and Weaknesses of Queueing Theory • Queueing models necessarily involve approximations • • • • and simplification of reality Results give a sense of order of magnitude, changes relative to a baseline, promising directions in which to move Closed-form results essentially limited to “steady state” conditions and derived primarily (but not solely) for birth-and-death systems and “phase” systems Some useful bounds for more general systems at steady state Numerical solutions increasingly viable for dynamic systems • Huge number of important applications A Code for Queueing Models: A/B/m Distribution of service time Queueing System Number of servers –/–/– Distribution of interarrival time Customers Queue CCCCCC C C C C S S S S Service facility • Some standard code letters for A and B: _ M: Negative exponential (M stands for memoryless) _ D: Deterministic _ Ek:kth-order Erlang distribution _ G: General distribution Terminology and Notation • Number in system: number of customers in • • • • • • queueing system Number in queue or “Queue length”: number of customers waiting for service Total time in system and waiting time N(t) = number of customers in queueing system at time t Pn(t) = probability that N(t) is equal to n at time t λn: mean arrival rate of new customers when N(t) = n μn: mean (total) service rate when N(t) = n Terminology and Notation (2) • Transient state: state of system at t is influenced by the state of the system at t = 0 • Steady state: state of the system is independent of initial state of the system • m: number of servers (parallel service channels) • If λn and the service rate per busy server are constants λ and μ, respectively, then λn=λ, μn= min (nμ, mμ); in that case: _ Expected inter-arrival time = 1/λ _ Expected service time = 1/μ Some Expected Values of Interest at Steady State • Given: _ _ Little’s Law Number of users A(t): cumulative arrivals to the system C(t): cumulative service completions in the system λ = arrival rate μ = service rate per service channel A(t) • Unknowns: L = expected number of users in queueing system _ Lq = expected number of users in queue _ W = expected time in queueing system per user (W = E(w)) _ Wq = expected waiting time in queue per user (Wq = E(wq)) • 4 unknowns ⇒ We need 4 equations N(t) _ C(t) t T ∫ LT = 0 N (t ) dt T T = T A(T ) ∫0 ⋅ T A(T ) N (t ) dt = λT ⋅ WT Time Relationships among L, Lq, W, Wq • Four unknowns: L, W, Lq, Wq • Need 4 equations. We have the following 3 equations: _ L = λW (Little’s law) Lq = λWq _ W = Wq + _ 1 μ • If we can find any one of the four expected values, we can determine the three others • The determination of L (or other) may be hard or easy depending on the type of queueing system at hand ∞ • L = ∑ nPn (Pn : probability that n customers are in the system) n=0 The Fundamental Relationship queue plus in service) arrivals are Poisson at rate of λn per unit of time. 4. Whenever n users are in system, service completions are Poisson at rate of μn per unit of time. 5. FCFS discipline (for now). The differential equations that determine the state probabilities After a simple manipulation: λnΔt 1-(λn+ μn)Δt 1. m parallel, identical servers. 2. Infinite queue capacity (for now). 3. Whenever n users are in system (in Pn (t + Δt) = Pn +1 (t) ⋅ μ n +1 ⋅ Δt + Pn −1 (t) ⋅ λn −1 ⋅ Δt + Pn (t) ⋅[1 − ( μ n + λn ) ⋅ Δt] Time: t+Δt n+1 users Time: t Birth-and-Death Queueing Systems Pn(t) = Prob [n users in system at time t] n users n users dPn (t) = −(λn + μ n ) ⋅ Pn (t) + λn −1 ⋅ Pn −1 (t) + μ n +1 ⋅ Pn +1 (t) dt (1) applies when n = 1, 2, 3,….; when n = 0, we have: μnΔt dP0 (t) = −λ0 ⋅ P0 (t) + μ1 ⋅ P1 (t) dt n-1 users Pn (t + Δt) = Pn +1 (t) ⋅ μ n +1 ⋅ Δt + Pn −1 (t) ⋅ λn −1 ⋅ Δt + Pn (t) ⋅[1 − ( μ n + λn ) ⋅ Δt] (2) • The system of equations (1) and (2) is known as the Chapman-Kolmogorov equations for a birth-and-death system (1) Birth-and-Death System: State Transition Diagram The “state balance” equations • We now consider the situation in which the queueing λ0 system has reached “steady state”, i.e., t is large enough to have Pn (t) = Pn , independent of t, or dPn (t) = 0 dt 0 n=0 (3) n = 1, 2, 3,.. (4) • The state balance equations can also be written directly from the state transition diagram λ2 1 2 μ1 • Then, (1) and (2) provide the state balance equations: λ0 ⋅ P0 = μ1 ⋅ P1 (λn + μ n ) ⋅ Pn = λ n −1 ⋅ Pn −1 + μ n +1 ⋅ Pn +1 λ1 λm-1 λm+1 m …… m+1 μm μ3 μ2 λm μm+1 …… μm+2 • We are interested in the characteristics of the system under equilibrium conditions (“steady state”), i.e., when the state probabilities Pn(t) are independent of t for large values of t • Can write system balance equations and obtain closed form expressions for Pn, L, W, Lq, Wq M/M/1: Observing State Transition Diagram from Two Points Solving….. Solving (3) and (4), we have: • λ λ ⋅λ λ P1 = 0 ⋅ P0 ; P2 = 1 ⋅ P1 = 1 0 ⋅ P0 μ1 μ2 μ 2 ⋅ μ1 and, in general, λ ⋅λ ⋅.....⋅ λ1 ⋅ λ0 ⋅ P0 = K n ⋅ P0 Pn = n −1 n − 2 μ n ⋅ μ n −1 ⋅.....⋅ μ 2 ⋅ μ1 1= But, we also have: Giving, 1 P0 = 1+ ∞ ∑ Kn n =1 etc. From point 1: λP0 = μP1 (λ + μ )P1 = λP0 + μP2 λ λ 0 μ ∞ ∞ n =0 n =1 Condition for steady state: ∞ ∑ Kn < ∞ n=1 • λ … 2 1 μ ∑ Pn = P0 ⋅ (1 + ∑ K n ) (λ + μ )Pn = λPn−1 + μPn+1 λ n-1 n+1 n μ μ μ λ λ λ λ λ λ μ μ From point 2: λP0 = μP1 0 λ … 2 1 μ λPn = μPn+1 λP1 = μP2 λ μ μ n-1 μ n+1 n μ λ λ μ μ M/M/1: Derivation of P0 and Pn P1 = Step 1: ∞ ∑P Step 2: n n=0 Step 3: ρ= Step 4: ⎛λ⎞ ⎛λ⎞ λ P0 , P2 = ⎜⎜ ⎟⎟ P0 , L, Pn = ⎜⎜ ⎟⎟ P0 μ ⎝μ⎠ ⎝ μ ⎠ n ∞ ⎛λ⎞ = 1, ⇒ P0 ∑ ⎜⎜ ⎟⎟ = 1 ⇒ P0 = n=0 ⎝ μ ⎠ λ , then μ P0 = ⎛λ⎞ ∞ n ∞ ∑ ⎜⎜ μ ⎟⎟ = ∑ ρ n=0 ⎠ ⎝ 1 ∞ ∑ρ n=0 = 1− ρ n n = ∞ ∞ ∞ n=0 n=0 n=0 n=1 d ⎛ ∞ n⎞ d ⎛ 1 ⎞ ⎜ ⎟ = (1− ρ ) ρ ⎜ ∑ ρ ⎟ = (1− ρ ) ρ dρ ⎝ n=0 ⎠ dρ ⎜⎝ 1− ρ ⎟⎠ λ 1 ⎛λ⎞ ∑ ⎜⎜ ⎟⎟ n=0 ⎝ μ ⎠ ∞ ∞ • L = ∑ nPn =∑ nρ n (1− ρ ) = (1− ρ )∑ nρ n = (1− ρ ) ρ ∑ nρ n−1 n 2 M/M/1: Derivation of L, W, Wq, and Lq ⎛ 1 ⎞ ρ λ μ ⎟= = = = (1− ρ ) ρ ⎜⎜ 2 ⎟ ⎝ (1− ρ ) ⎠ (1− ρ ) 1− λ μ μ − λ L 1 λ 1 •W= = ⋅ = λ μ −λ λ μ −λ n 1− ρ ∞ 1 = (Q ρ < 1) 1− ρ 1− ρ 1 • Wq = W − = μ and Pn = ρ n (1− ρ ) • Lq = λ Wq = λ ⋅ n=0 High Sensitivity of Delay at High Levels of Utilization 1 μ −λ − 1 μ = λ μ (μ − λ ) λ λ2 = μ (μ − λ ) μ (μ − λ ) M/M/1: An alternative, direct derivation of L and W • For an M/M/1 system, with FCFS discipline: Expected delay ∞ W =∑ (n +1) n=0 μ ⋅ Pn = E[ N +1 μ ]= E[N ] +1 μ = L +1 μ • But from Little’s theorem we also have: L = λ ⋅W (2) • It follows from (1) and (2) that, as before: Demand Capacity ρ=1 L= λ μ −λ ; W = 1 μ −λ Does the queueing discipline matter? (1) Additional important M/M/1 results • The pdf for the total time in the system, w, can be computed for a M/M/1 system (and FCFS): M/M/1: E[B], the expected length of a busy period N B = busy period I = idle period f w (w) = (1 − ρ ) μe −(1− ρ ) μw = ( μ − λ )e −( μ − λ )w for w≥ 0 Thus, as already shown, W = 1/(μ -λ) = 1/[μ (1-ρ)] • The standard deviation of N, w, Nq, wq are all proportional to 1/(1-ρ), just like their expected values (L, W, Lq, Wq, respectively) • The expected length of the “busy period”, E[B], is equal to 1/(μ -λ) t I P0 = But, B I B I B E[length Idle period ] E[length Busy period ] + E[length Idle period ] P0 = 1− ρ Therefore, E[length Idle period ] = 1 E[B] = E[length Busy period ] = 1 ⋅ λ 1 μ (1− ρ ) = 1 μ −λ