Queuing Theory and Stochastic Service Systems Li Xia
Syllabus Instructor Li Xia 夏俐, FIT 3 618, 62793029, xial@tsinghua.edu.cn Text book D. Gross, J.F. Shortle, J.M. Thompson, and C.M. Harris, Fundamentals of Queueing Theory, 4th Edition, Hoboken: Wiley, 2008. (copyis provided) Reference books: Leonard Kleinrock, Queueing Systems, vol. 1: Theory, John Wiley, 1975. Caltech course (Prof. Adam Wierman): http://courses.cms.caltech.edu/cs147/ h / / 林闯, 计算机网络和计算机系统的性能评价, 清华大学出版社,2001. 2
Grading Syllabus Homework: 40% (4 assignments) Course Interaction: 10% Midterm Presentation: 20% (paper reading) Final Projects\Exams: 30% Lecture notes and assignments are available online (in English) http://cfins.au.tsinghua.edu.cn/personalhg/xiali /teaching/course_queues.htm 3
Beijing Subway Throughput? h Safety? 4
Railway ticket online booking in 2012 Chinese new year Crash of ticket booking system Large number of tickets for sale (4million) Vast visit requests 秒杀? (billion) System architecture is not optimal Bandwidth of network access 5
How to solve it? Modeling and Analysis Performance analysis and optimization Queueing scheme, increase bandwidth Internet client Web server Application server Database server 6
Applications in daily life Supermarkets How long customers have to wait at checkouts? Behavior of waiting time during peak hours Number of checkouts? Line in counters of bank Multiple lines v.s. one line Number of counters? 7
Applications in engineering Computer/circuit /i i architecture design 1 fast disk v.s. 2 slow disks? Invest on large buffer v.s. fast CPU? Scheduling policy to improve performance Communication network design Buffer size design of switch/router Data packet scheduling policy in sensor or mobile network 8
List of applications areas Production system (machine, different products) Computer system (cpu, disk, RAM design) Communication network k(buffer design, link capacity) Transportation system (traffic lights control) Bankbranches operation (counter/type design) Airlines scheduling (takeoff/landing arrangement) Data center (optimal control, energy saving) Call center (optimize the operators, hotlines, ) Post office ce( (multi class, ut specialization) at 9
What s queue? A general queuing system Customer arrival Customer departure waiting room Service facility Basic elements Arrival pattern, service pattern, queue discipline, system capacity, customer type,.. 10
Why we need queuing theory? Resource constraints Design thearchitecture Formulate the system model Analyze the system performance Optimize the system performance Counter intuitive Randomness is complicated Some examples 11
CPU design A simple model of CPU Job arrival at rate λ, Poisson process Job mean size is 1/μ, exponential i.e., service rate is μ FCFS(first come first serve), buffer is infinite assume λ < μ, [question]why? λ buffer CPU μ Model of a cpu 12
CPU design, cont. If the arrival rate λ doubles, how to upgrade? If want to maintain the same delay of jobs, [question] what you choose? A. double μ B. less than double μ C. more than double μ Why? Double μ will cut the delay in half prove with M/M/1 queuing theory Physical intuition, time speeds up with scale 2 13
Lines in bank Customer arrival in Poisson with rate λ Counter service rate is μ, exponential FCFS, infinite waiting capacity λ μ μ λ μ 3λ μ λ μ μ 3 lines 1 line 14
Lines in bank, cont. Assume μ = 2/min, λ = 1/min queue length, 1 2 waiting time, response time, L 1 =1.5, L 2 =0.237 W 1 =0.5min, W 2 =0.079min T T1 =1min, T 2 =0.579min [question] how is the following queue? 3λ 3μ 15
Closed queueing network Model the intensive traffic with N capacity of network Batch system, intensive queue with limited capacity, etc. N=6 jobs 0.5 μ = 1 1 3 0.5 μ = 1 1 3 16
Closed queueing network, cont. If we double the speed of server 1 How it effects the response time of job? How it effects the throughput? [Answer] only change by a small amount Suppose N is very large, how is above question? Change 0, if N What if N is very small If N=1, changed amount is large 17
Closed queueing network, cont. What if the queueing network is open? remarkable improvement of throughput and average response time λ 05 0.5 1 μ = 1 3 0.5 μ = 1 1 3 18
Scheduling How service disciplines affect response time? FCFS, first come first serve LCFS, last come first serve Random [answer] all the same λ μ 19
Scheduling, cont. What if PR LCFS, preemptive resumed LCFS? Depends on the randomness of job size High randomness, big improvement No randomness, worse λ μ 20
Summary of examples Why counter intuition? Randomness of queuing Interactions among customers and servers Toy example, but many insights i Models Analysis Optimization 21
Basic concepts of probability theory Random variable discrete/continuous random variable Transform Z transform, Laplace transform Distribution Geometric, Binomial, Poisson, exponential, Erlang, Hyperexponential, phase type 22
Random variable X is denoted as random variable Discrete random variable, if X is discrete Continuous random variable, if X is continuous Distribution function, or called cdf, cumulative distribution function F(x)=Pr(X<x) () ( ) Probability density function, pdf f(x)=pr(x=x), x is discrete f(x)= F(x)/ x, x is con nuous 23
Random variable Mean: E(X) Variance: Var(X), or σ 2 (X) σ 2 (X) = E{(X E(X)) 2 }=E(X 2 ) E 2 (X) Standard deviation: σ(x) Covariance of two random variables X, Y Cov(X,Y)=E{(X E(X))(Y E(Y))} E(X))(Y E(Y))} Correlation coefficient of X, Y r(x,y)=cov(x,y)/ σ(x)σ(y) 1 r(x,y) 1 24
Coefficient of variation: Coefficient of variation: c X c X = σ(x)/e(x) c X =0: deterministic c X <1: smooth c X =1: pure random c X >1: bursty Figures as example t t t 25
Discrete Random Variables 26
Discrete Random Variables 27
Continuous Random Variables 28
Continuous Random Variables 29
Z transform for discrete distribution Z transform is also called generating function P(z): Z transform of discrete r.v. X, p(n)=pr(x=n), assume n=0,1,2, Pz ( ) Ez ( X ) pnz ( ) Property = = n= 0 P (0) = p (0), P (1) = 1, P (1) = E ( X ) n P (1) =? 30
Laplace transform for continuous distribution F*(s): Laplace transform of a continuous r.v. X pdf of X is f(x), cdf of X is F(x), assume x 0 * sx sx F s = e f x dx= e df x 0 0 ( ) ( ) ( ) Property Shortcut to calculate l the k moment of X * * *( k) k k F (0) = 1, F (0) = E( X), F (0) = ( 1) E( X ) * sx F () s = s e F() x dx 0 31